Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
PCRE (PHP <7.3)

/
(?:(?# #json->start)(?:(?# #array->start)\[\s*(?:(?# #element-in-array->start)(?:(?# #object->start){\s*(?:(?:(?# #key:value->start)(?:(?:(?# #key->start)"[a-zA-Z_]\w*"(?##key->end))\s*:\s*(?:(?# #value->start)(?R)|"(?:\\.|[^\\"]*)*"|[+-]?(?:[1-9]\d*|0)(?:\.\d+)?|true|false|null(?#value->end)))(?# #key:value->end))(?:\s*,\s*(?:(?# #key:value->start)(?:(?:(?# #key->start)"[a-zA-Z_]\w*"(?##key->end))\s*:\s*(?:(?# #value->start)(?R)|"(?:\\.|[^\\"]*)*"|[+-]?(?:[1-9]\d*|0)(?:\.\d+)?|true|false|null(?#value->end)))(?# #key:value->end)))*)?\s*}(?# #object->end))|(?:(?# #value->start)(?R)|"(?:\\.|[^\\"]*)*"|[+-]?(?:[1-9]\d*|0)(?:\.\d+)?|true|false|null(?#value->end))(?# #element-in-array->end))(?:\s*,\s*(?:(?# #element-in-array->start)(?:(?# #object->start){\s*(?:(?# #key:value->start)(?:(?:(?# #key->start)"[a-zA-Z_]\w*"(?##key->end))\s*:\s*(?:(?# #value->start)(?R)|"(?:\\.|[^\\"]*)*"|[+-]?(?:[1-9]\d*|0)(?:\.\d+)?|true|false|null(?#value->end)))(?# #key:value->end))(?:\s*,\s*(?:(?# #key:value->start)(?:(?:(?# #key->start)"[a-zA-Z_]\w*"(?##key->end))\s*:\s*(?:(?# #value->start)(?R)|"(?:\\.|[^\\"]*)*"|[+-]?(?:[1-9]\d*|0)(?:\.\d+)?|true|false|null(?#value->end)))(?# #key:value->end)))*\s*}(?# #object->end))|(?:(?# #value->start)(?R)|"(?:\\.|[^\\"]*)*"|[+-]?(?:[1-9]\d*|0)(?:\.\d+)?|true|false|null(?#value->end))(?# #element-in-array->end)))*\s*\]|\[\s*\](?# #array->end))|(?:(?# #object->start){\s*(?:(?:(?# #key:value->start)(?:(?:(?# #key->start)"[a-zA-Z_]\w*"(?##key->end))\s*:\s*(?:(?# #value->start)(?R)|"(?:\\.|[^\\"]*)*"|[+-]?(?:[1-9]\d*|0)(?:\.\d+)?|true|false|null(?#value->end)))(?# #key:value->end))(?:\s*,\s*(?:(?# #key:value->start)(?:(?:(?# #key->start)"[a-zA-Z_]\w*"(?##key->end))\s*:\s*(?:(?# #value->start)(?R)|"(?:\\.|[^\\"]*)*"|[+-]?(?:[1-9]\d*|0)(?:\.\d+)?|true|false|null(?#value->end)))(?##key:value->end)))*)?\s*}(?# #object->end))|(?:(?# #value->start)"(?:\\.|[^\\"]*)*"|(?<=[,:\s\[])[+-]?(?:[1-9]\d*|0)(?:\.\d+)?(?=[\s,\]}])|true|false|null(?#value->end))(?# #json->end))
/
gm

Description

no description available

Submitted by anonymous - 5 years ago