Is there a regex for not including a given word, but matching another pattern?
I have a simple pattern like the following for grabbing words in a parser I'm using.
field = re.compile(r"[a-zA-Z0-9]+")
It works fine for the parser to determine whether something is a variable or function, but I'm running into an issue where it grabs the closing code blocks, which use the end keyword.
foo = 3
end if <-- end is a keyword and should not be counted as a variable
Is there a way to update the regex to match all the words it currently matches except for the word end?
foo would be a match.
en would be a match.
end would not be a match.
endx would be a match.