Regex to match anything (including the empty string) except a specific given string.
- by dreeves
I'd like to test whether a string contains "Kansas" followed by anything other than " State".
Examples:
"I am from Kansas" true
"Kansas State is great" false
"Kansas is a state" true
"Kansas Kansas State" true
"KansasState" true
(For my immediate purposes this should work with mysql's REGEXP but if there's a more elegant way using PCRE, I'd like to see that too.)