Regular Expressions 101

Lookahead and lookbehind example

Open Workspace
  • PCRE2 (PHP)
  • Match
0

Regular Expression

/
(?<!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