Okay, so I'm trying to use a regular expression to match instances of a character only if it hasn't been escaped (with a backslash) and decided to use the a negative look-behind like so:
(?<!\\)[*]
This succeeds and fails as expected with strings such as foo*
and foo\*
respectively.
However, it doesn't work for strings such as foo\\*
, i.e - where the special character is preceded by a back-slash escaping another back-slash (an escape sequence that is itself escaped).
Is it possible to use a negative look-behind (or some other technique) to skip special characters only if they are preceded by an odd number of back-slashes?