Last active
August 29, 2015 14:21
-
-
Save rknuu/b945aa2df96daea9b2e1 to your computer and use it in GitHub Desktop.
seriously complicated regular expression in XQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(: taken from http://markmail.org/message/5p3uespuxk4ew7fa :) | |
let $regexp := '(\{)|(\})|(\[)|(\])|(:)|(,)|(true)|(false)|(null)|(\s+)|("([^"\\]|\\"|\\\\|\\/|\\b|\\f|\\n|\\r|\\t|\\u[A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9][A-Fa-f0-9])*")|(-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?)' | |
return | |
let $json := '{ | |
"firstName": "John", | |
"lastName": "Smith", | |
"address": { | |
"streetAddress": "21 2nd Street", | |
"city": "New York", | |
"state": "NY", | |
"postalCode": 10021 | |
}, | |
"phoneNumbers": [ | |
"212 732-1234", | |
"646 123-4567" | |
] | |
}' | |
return analyze-string($json, $regexp) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment