Create a regex that matches any kebab-case word, but not `foo` or `bar`

Viewed 22

I need a regex to identify strings that are kebab-case (lowercase, alphanumeric with dashes) but cannot be one of two known phrases like foo or bar

Kebab case is as easy as ^[a-z0-9-]+$ Not foo or bar is easy too...

But I'm struggling to combine this, need some kind of && statement.

0 Answers
Related