Regular Expressions 101

Sponsors

Library entries

0
pcre2

aff url normalize

conevrt url
Submitted by anonymous - 7 hours ago
0
pcre

amazIng regex

super
Submitted by anonymous - 11 hours ago
0
pcre2

Date time ISO_8601 Pattern

credits to Sayooj V R
Submitted by anonymous - a day ago
0
pcre2

routes

routes
Submitted by anonymous - a day ago
0
pcre

Only if before

Only if needle is before target
Submitted by anonymous - 3 days ago
0
pcre2

GS1-128 and RegEx

Parse the 3 groups of a GS1-128 Barcode
Submitted by Mike D - 3 days ago
0
pcre2

Dafne

.NSO.HORDIN_XMLDAFNEV..xml
Submitted by Dorino - 3 days ago
0
pcre2

12 hours regex

Define hour at 12 hours
Submitted by anonymous - 4 days ago
0
pcre2

Hour regex

Define 24 hour format
Submitted by anonymous - 4 days ago
0
pcre2

Model Code validator

Check the modelCode for iOS/iPadOS devices
Submitted by ppeelen - 4 days ago
0
pcre2

regex

remove pun
Submitted by anonymous - 5 days ago
0
pcre2

测试

竭莹用于在json中寻找评论的正则表达式
Submitted by anonymous - 8 days ago
0
dotnet

myRegEx

myRegEx
Submitted by Avinash - 8 days ago

match valid JSON

Vote

26

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 - 8 years ago