Reputation: 8181
I'm trying to create a regular expression that will match #rn: but not if it is followed by msg.
So
#rn:abc -> matches
#rn:msh -> matches
#rn:xy -> matches
#rn:defg -> matches
#rn:msg - does not match
I have tried \#rn\:[^m][^s][^g]
and \#rn\:[^(msg)]
but they don't work.
Can it be done?
Upvotes: 0
Views: 46
Reputation: 67988
\#rn\:(?!msg)
This shoudl do it for you.Here lookahead
ensure that after #rn:
there is not msg
.See demo.
https://regex101.com/r/tX2bH4/28
Upvotes: 3