Golang regex: doesn't end with string

Viewed 26

Usually I'd use something like this: /^(?!.*NOT_ENDING_WITH_THIS$).*$/

However, my Golang regex engine does not support negative lookaheads because they're not O(n).

I want the match to succeed if the string doesn't end in NOT_ENDING_WITH_THIS.

The expression I'm looking for is the inverse of this: ^(.*(NOT_ENDING_WITH_THIS))$

0 Answers
Related