Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regex AND'ing

Tags:

regex

I have to two strings that I want to match everything that doesn't equal them, the first string can be followed by a number of characters. I tried something like this, negating two ors and negating that result.

?!(?!^.*[^Factory]$|?![^AppName])

Any ideas?

like image 775
jtruelove Avatar asked Dec 30 '22 20:12

jtruelove


1 Answers

Try this regular expression:

(?!.*Factory$|.*AppName)^.*

This matches every string that does not end with Factory and does not contain AppName.

like image 130
Gumbo Avatar answered Feb 06 '23 10:02

Gumbo