Regular Expressions 101

Community Patterns

Fetch data between curly braces with plain text

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 - 9 years ago