Skip to content Skip to sidebar Skip to footer

Regex Matching - A Letter Not Preceded By Another Letter

What could be regex which match anystring followed by daily but it must not match daily preceded by m? For example it should match following string beta.daily abcdaily dailyabc d

Solution 1:

Just add a negative lookbehind, (?<!m)d, before daily:

(?<!m)daily

The zero width negative lookbehind, (?<!m), makes sure daily is not preceded by m.

Demo

Post a Comment for "Regex Matching - A Letter Not Preceded By Another Letter"