I would like a Python regular expression that matches a given word that\'s not between simple quotes. I\'ve tried to use the (?! ...) but without success.
Capture group 1 of the following regular expression will contain matches of 'foe'.
r'^(?:[^'\n]|\\')*(?:(?
Start your engine!
Python's regex engine performs the following operations.
^ : assert beginning of string
(?: : begin non-capture group
[^'\n] : match any char other than single quote and line terminator
| : or
\\' : match '\' then a single quote
) : end non-capture group
* : execute non-capture group 0+ times
(?: : begin non-capture group
(?