Regular Expressions 101

Community Patterns

Parsing JSON Constructs

0

Regular Expression
PCRE (PHP <7.3)

/
\{(?>[^{}]|(?R))*\}
/
gm

Description

This regular expression searches for a matching number of '{' and '}' and captures the curly brackets and everything inside them including nested constructs. I created it because of a need to parse JSON formatted lists.

Submitted by Zormaster - 4 years ago