Regular Expressions 101

Community Patterns

Community Library Entry

2

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?:(?!(?:not allowed|filter|mirc)).)*?(?:http:\/\/|www\.|porn|credit card)(?:(?!(?:not allowed|filter|mirc)).)*$
/
gim

Description

Match a string that contains any of the following substrings: http://, www., porn, or credit card. But don't match the text if it contains one of: not allowed, filter, or mirc.

Don't use word boundaries (anywhere in the text is fine).

If you need help, try reading this.

Submitted by anonymous - 3 months ago