Closed kengleong closed 1 year ago
This should work:
exp := regexp2.MustCompile("[\\u{00061}-\\u{0007A}]", regexp2.ECMAScript|regexp2.Unicode)
The original example doesn't work for a few reasons:
\u
will be interpreted by the compiler doesn't compile in this context. \\u
fixes this[\u{00061}-\u{0007A}]
doesn't work in basic ECMAScript. You must enable Unicode parsing for it to work (the "u" option). This is the same in regexp2
--you need to send ECMAScript|Unicode
as options for this unicode character parsing to work.
will end up with this error message
error parsing regexp: [}-u] range in reverse order in [\\u{0007A}-\\u{00061}]