regex lookahead but ignore if specific char is found

Viewed 19

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

1 Answers

This should work for you:

^on[^ ]+=$

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

Related