Closed Ja1Zhou closed 1 year ago
Hello,
I think the issue comes from a misunderstanding of the -
regex operator.
Here, when you write [<+-=>]
it means from the character +
to the character =
(as in [b-d]
, from b
to d
).
It's a little tricky, but I think it will fix your issue if you just escape the -
using \-
or simply put the -
at the end of the []
where it will lose its property: either use (?<=[a-zA-Z0-9])([<+\-=>])
or (?<=[a-zA-Z0-9])([<+=>-])
.
From https://regexr.com/:
Matches a character in the range "+" to "=" (char code 43 to 61). Case sensitive.
Let me know if it worked :)
Works like a charm, much appreciated~
I spent a lot of time debugging, and found that this snippet
Somehow matches unintended cases such as
m3 -> m 3
, and30 -> 3 0
. I have made sure that the problem was triggered by this exact fragment, yet I really have difficulty figuring out the cause, since the captured group has nothing to do with numbers. Help would be much appreciated.