Hi I’m looking for a regular expression for: line of text that does not end with a certain word, let’s say it’s “abcd”
At first I tried with
.*[^abcd]$
That one doesn’t work of course. It matches a line that doesn’t end with any of the letters a,b,c or d.
So, in Advanced Grep Topics, I found this expression, but couldn’t get it to work:
^(?>.*)(?<=abcd)
->
grep -e "^(?>.*)(?<=abcd)$"
Any idea for the expression I need?
Have a look at
grep‘s -v optionIf you really meant word rather that just "sequence of characters" then use
\bmeaning "word-boundary"