Reputation: 289
Sorry if the answer was out there somewhere. I did my research but couldn't find it.
I want to build a regular expression pattern that will match a line in the following format:
I know that ^ in square brackets means "except for any of the characters". How do I exclude a phrase instead of single characters? Obviously, the pattern below didn't do what I wanted:
^sccp [^ccm group]
Thanks!
Upvotes: 1
Views: 926
Reputation: 2991
You should be able to use ^sccp (?!ccm group)
or ^sccp (?!ccm group).*
which uses a negative lookahead to assert that the phrase "ccm group" does not come after the space. Try it here.
If "sccp " should not match (i.e. nothing after the space), then use ^sccp (?!ccm group).+
.
Information on the negative lookahead can be found here.
Upvotes: 1