Regular Expressions 101

Sponsors

Library entries

2
python

Regex for Chemical Compounds

no description available
Submitted by Haiming Zhao - 7 years ago
2
javascript

Remove XSS

no description available
Submitted by Harish Thakur - 7 years ago
2
pcre

DateWithDay

no description available
Submitted by BobD - 7 years ago
2
javascript

SSN

allow nine digits only
Submitted by anonymous - 7 years ago
2
pcre

IPv4 strict

Valid: 000.01.249.255 1.199.200.0 0.0.0.0 Invalid:...
Submitted by MaxusR - 7 years ago
2
pcre

desanonimyse

no description available
Submitted by JB Escudié - 7 years ago
2
pcre

MONTHDAY

no description available
Submitted by anonymous - 7 years ago
2
pcre

hex number check

check if a string is a hex number
Submitted by anonymous - 7 years ago
2
pcre

Numéro de sécurité sociale (France)

no description available
Submitted by Anas - 7 years ago
2
pcre

get all between 2 lines

no description available
Submitted by anonymous - 7 years ago
2
pcre

Positive Ints

no description available
Submitted by anonymous - 7 years ago
2
pcre

mikrotik

no description available
Submitted by anonymous - 7 years ago
2
pcre

Diiff

no description available
Submitted by anonymous - 7 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 - 4 years ago