Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

regex lookahead but ignore if specific char is found

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

This should work for you:

^on[^ ]+=$

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading