Regular Expressions 101

Community Patterns

Have one word and don't have another

1

Regular Expression
PCRE (PHP <7.3)

/
^(?!.*\/prod\/).*\/cat\/.*$
/
g

Description

Search for /cat/ in the string where don't have /prod/ itself.

Submitted by Douglas Ianitsky - 8 years ago