Home > Enterprise >  regex lookahead but ignore if specific char is found
regex lookahead but ignore if specific char is found

Time:09-21

so I have this text

onmousedown=
on mousedown=

I want to identify all "on" words that are succeded by a "=", but not if there is a space between the "on" word and the "=" => line 1 should be a match (on) => line 2 should not be a match

CodePudding user response:

This should work for you:

^on[^ ] =$

it matches on followed by non-whitespace characters followed by =

  • Related