Closed lozaericml closed 5 years ago
Hello! The regexp2
engine matches the behavior of the C# regular expression engine and not all patterns that are valid for the Go stdlib regexp
package are valid for regexp2
(and vise versa). This pattern gives the same error in the C# engine, so this is as-designed.
A couple notes on your pattern:
_
is unnecessary\w
includes _
already, so you don't need to include it at all[]
) isn't needed each character (including escapes) is already in an OR automationlly.I think the pattern you want is: ^/legacy/([\w\d\-]+)/([\w\d\-]+)/.*
Thanks, Doug
Hi!
If pattern contains
\_
, regexp2 fails to compile it. Example:Error is
error parsing regexp: unrecognized escape sequence \_ in ^/legacy/([\w|\d|\-\_]+)/([\w|\d|\-\_]+)/.*)
This pattern works in regexp package.
thanks!