I am debugging some JavaScript code and I need to identify lines that contain " = " followed by a comparison operator such as "==", ">", "<", "!=". However, I want to ignore lines that are preceded by the start of a for loop. So I want to identify lines like this:
x = (y > z) * 2;
but ignore lines like this:
for (var i = 1; i<5; i++) {
This would require a negative lookbehind, I believe. But the text "for ", which I would put in the negative lookbehind, does not immediately precede the text I want to match.
I tried this regular expression in Notepad++:
(?<!for .*) = .*(==|>|<|!=)
but it was reported as "invalid" because a quantifier inside a lookbehind makes it a non fixed width.
On the other hand, this regex works but doesn't help me because "for " does not immediately precede the text I want to match:
(?<!for ) = .*(==|>|<|!=)
Any suggestions would be appreciated.