Regular Expressions 101

Sponsors

Library entries

2
javascript

get href

gets value of href
Submitted by me - 6 years ago
2
pcre

Separating Server and Domain from FQDN

no description available
Submitted by Awan - 6 years ago
2
pcre

fiddler raw to php array

no description available
Submitted by anonymous - 6 years ago
2
javascript

URL with Port

no description available
Submitted by rkl - 6 years ago
2
pcre

Course GUID

no description available
Submitted by anonymous - 6 years ago

Regex to match any JSON value with fewer steps possible

Vote

2

Regular Expression
pcre

/
(?smx) (?(DEFINE) (?<jsonObject> \{(?&jsonField)(?>,(?&jsonField))*+\}| \{[[:space:]]*+\} ) (?<jsonArray> \[(?&jsonValue)(?>,(?&jsonValue))*+\]| \[[[:space:]]*+\] ) (?<string> " [^"\\]*+ (?> (?> \\["\\\/rntfb]| \\u[[:xdigit:]]{4} )++ [^"\\]*+ )*+ " ) (?<number> \-?+ (?> [1-9][[:digit:]]*+| 0 ) (?>\.[[:digit:]]++)?+ (?>[eE][\+\-]?+[[:digit:]]++)?+ ) (?<jsonValue> [[:space:]]*+ (?> (?&string)| (?&number)| (?&jsonObject)| (?&jsonArray)| false| true| null ) [[:space:]]*+ ) (?<jsonField> [[:space:]]*+(?&string)[[:space:]]*+\: (?&jsonValue) ) ) ^(?&jsonValue),\n
/
g

Description

Loading markdown...
Submitted by anonymous - 3 years ago