Reputation: 716
For example, if I have 3 words:
throw
growing
plows
I'm wanting something that will return only words without 'ow' on the end:
growing
plows
Basically the exact opposite of:
/ow$/
So it will only return the words when 'ow' does NOT show up on the end.
Upvotes: 1
Views: 1496
Reputation: 1
Right, when 'ow' does NOT show up at the end of the word:
/\b\w+(?<!ow)\b/i
Use word boundaries \b
and word characters \w
together with lookbehind (?<!ow)
Upvotes: 0
Reputation: 6017
Python code:
lst = ["throw","growing","plows"]
for item in lst:
if not str.endswith(item.lower(), "ow"):
print item
Upvotes: 0
Reputation: 67988
^.*(?<!ow)$
You can use lookbehind
here.See demo.
https://regex101.com/r/cT0hV4/4
Upvotes: 1