Regular Expressions 101

Community Patterns

Lookahead and lookbehind example

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?<!XXY)(?<=Y)\w(?=Y)(?!YYXX)
/
gm

Description

An example of lookahead and lookbehind, both negative and positive. Allows to limit matches within specified limits without capture groups

Submitted by CAMOKPYT - a year ago