Match combinations with Regex, except under certain conditions

Viewed 20

Let's say I want to find all periods in a sentence that are immediately followed by a space.

Like:

/\. /g

But I want to exclude them when this combination is immediately preceded by a capital "M". How could I do this?

I found out about the negative look ahead. This is what I have tried so far:

/(?!M\.)(\. )/g

This doesn't work. Not sure why...

0 Answers
Related