user1541301
user1541301

Reputation: 325

regex negative lookahead not working

I need a regex to search a string for M?' not followed by , or )

I think I need a negative lookahead, but I can't seem to get it working:

M?'(?!,|\))

Any help would be greatly appreciated.

Thanks!

Upvotes: 1

Views: 360

Answers (3)

Louay Alakkad
Louay Alakkad

Reputation: 7408

M\?'(?![,\)])
_^

See demo here

Upvotes: 0

user2705585
user2705585

Reputation:

Try with M\?'(?!,|\))

Regex101 Demo

Upvotes: 1

Saleem
Saleem

Reputation: 8978

I believe ? is part of search string so try following regex:

M\?'(?!,|\))

Upvotes: 1

Related Questions