Regular Expressions 101

Community Patterns

1...56789...901

Community Library Entry

3

Regular Expression
PCRE (PHP <7.3)

/
(?=\{((?:[^{}]++|\{(?1)\})++)\})
/

Description

This regex fetch only the data between content in curly braces (first occurrence, use preg_match_all in php, for all occurrences). This is useful for bad JSON files with wrong format or text between.

Submitted by shakaran87 - 10 years ago