I’m working on a project with heavy use of the Module “Regex”.
The functions in this module have usually this structure : Regex.function (regex, string).
Therefore the use of the pipe operator is not suitable.
Is there a solution ?
I’m working on a project with heavy use of the Module “Regex”.
The functions in this module have usually this structure : Regex.function (regex, string).
Therefore the use of the pipe operator is not suitable.
Is there a solution ?
You can write some wrappers for heavily used functions. In wrapper you could reorganize parameter list, for example MyRegex.function(string, regex)
It’s also totally fine to just not use the pipe operator. Sometimes it is over used.
It’s worth noting that you can use
String.replace(string, regex, replacement)
,String.split(string, regex)
, andString.match?(string, regex)
instead of the equivalent Regex
functions.
Awesome, thank you guys for your answers !