Unexpected result: Using an escape character to escape the character

I think the problem is in this. These aren’t regular expressions, where the first branch that matches is taken—these are nondeterministic automata, which conceptually take all matching branches at the same time. So you’ll want to include the backslash in the negative groups (![\\ ,]) to make sure that branch doesn’t get taken for backslashes.

1 Like