Regular Expressions 101

Community Patterns

Community Library Entry

1

Regular Expression
PCRE (PHP <7.3)

/
(?<!a| c(?=bobd) ) bob(?!b)
/
x

Description

This regex matches "bob" but does not match "abob", "bobb" or "cbobd" while it does match "cbob" and "bobd".

Here "bob" is the dirty word and "abob", "bobb" and "cbobd" are safe phrases

Submitted by Alex - 9 years ago