Regular Expressions 101

@regex101
Donate
Sponsor
Contact
Bug Reports & Feedback
Wiki
Whats new?

Library entries

0
pcre2
Submitted by anonymous - 6 hours ago

get first number from string

no description available
0
pcre2
Submitted by anonymous - 16 hours ago

ReName_01_

no description available
0
pcre2
Submitted by anonymous - 18 hours ago

6 digit Sort Code without dashes

no description available
0
python
Submitted by anonymous - 20 hours ago

Question 2

no description available
0
pcre
Submitted by anonymous - a day ago

CODA download log

no description available
0
pcre2
Submitted by anonymous - 2 days ago

Dup words

no description available
2
pcre2
Submitted by anonymous - 2 days ago

Dutch zipcodes

no description available
1
pcre2
Submitted by anonymous - 2 days ago

Dutch mobile phone number

no description available
0
pcre
Submitted by anonymous - 2 days ago

Url regex

no description available
0
pcre
Submitted by anonymous - 2 days ago

aaa

no description available
0
pcre2
Submitted by anonymous - 2 days ago

Aplayer Icons Regex

no description available
0
pcre2
Submitted by anonymous - 2 days ago

cisco command

no description available
0
pcre2
Submitted by Habibi Mustafa - 2 days ago

Minify HTML

Remove Whitespace Remove Comment
0
pcre2
Submitted by anonymous - 2 days ago

get main content if has :

no description available
0
python
Submitted by anonymous - 2 days ago

conditional phone numbers

no description available

match valid JSON

Regular Expression
pcre

/
(?(DEFINE) # Note that everything is atomic, JSON does not need backtracking if it's valid # and this prevents catastrophic backtracking (?<json>(?>\s*(?&object)\s*|\s*(?&array)\s*)) (?<object>(?>\{\s*(?>(?&pair)(?>\s*,\s*(?&pair))*)?\s*\})) (?<pair>(?>(?&STRING)\s*:\s*(?&value))) (?<array>(?>\[\s*(?>(?&value)(?>\s*,\s*(?&value))*)?\s*\])) (?<value>(?>true|false|null|(?&STRING)|(?&NUMBER)|(?&object)|(?&array))) (?<STRING>(?>"(?>\\(?>["\\\/bfnrt]|u[a-fA-F0-9]{4})|[^"\\\0-\x1F\x7F]+)*")) (?<NUMBER>(?>-?(?>0|[1-9][0-9]*)(?>\.[0-9]+)?(?>[eE][+-]?[0-9]+)?)) ) \A(?&json)\z
/
x

Description

Loading markdown...
Submitted by Mateon1 - 6 years ago