Regular Expressions 101

Community Patterns

123...6

simple json key value pair parser

0

Regular Expression
PCRE2 (PHP >=7.3)

/
(?="_id"\s*:)(?&key_value) (?(DEFINE) (?<string_inner>(?<=["])(?>[^"\\]++|[\\].)++(?=["])) (?<string>["](?&string_inner)?+["]) (?<object>[{]\s*+(?&key_values)?+\s*+[}]) (?<array>\[\s*+(?&values)?+\s*+\]) (?<key_values>(?&key_value)(?>\s*+[,]\s*+(?&key_value))*+) (?<key_value>(?&string)\s*+[:]\s*+(?&value)) (?<number>[-]?+\d++(?>[.]\d++)?+(?>[Ee][+-]?+\d++)?+) (?<bool>true|false) (?<scalar>(?&bool)|(?&number)|(?&string)|null) (?<value>(?&scalar)|(?&object)|(?&array)) (?<values>(?&value)(?>\s*+[,]\s*+(?&value))*+) )
/
gmx

Description

no description available

Submitted by amlang - 8 years ago (Last modified 3 months ago)