Stream: fhirpath
Topic: XML Schema for regex?
Bryn Rhodes (Feb 01 2019 at 04:04):
This comment (GF#19891) suggests that FHIRPath standardize on the regex schema (SHALL, instead of SHOULD). We intentionally made it a recommendation to reduce implementer burden, any thoughts on whether we should go ahead and rqeuire XML Schema regex?
Grahame Grieve (Feb 01 2019 at 04:07):
is there a way to find out what libraries are compliant? a test set?
Lloyd McKenzie (Feb 01 2019 at 04:15):
The operation is pretty useless if it's not implemented consistently across platforms...
Bryn Rhodes (Feb 01 2019 at 04:16):
Bryn Rhodes (Feb 01 2019 at 04:17):
And there's RegexBuddy, we can have it just translate flavors for us: https://www.regular-expressions.info/refflavors.html
Bryn Rhodes (Feb 01 2019 at 04:18):
245 flavors!
Grahame Grieve (Feb 01 2019 at 04:19):
the stack overflow reference is nice, but which is the schema one(s)?
Bryn Rhodes (Feb 01 2019 at 04:20):
https://www.regular-expressions.info/xml.html
Bryn Rhodes (Feb 01 2019 at 04:21):
Reading up on the XML Schema one there is interesting.
Bryn Rhodes (Feb 01 2019 at 04:22):
Based on that writeup, my guess is that all of those test suites would fail on an XML Schema regex engine.
Bryn Rhodes (Feb 01 2019 at 04:22):
(Because they would test features the XML Schema regex doesn't support)
Grahame Grieve (Feb 01 2019 at 04:26):
XML regular expressions don't have any tokens like \xFF or \uFFFF to match particular (non-printable) characters. You have to add them as literal characters to your regex. If you are entering the regex into an XML file using a plain text editor, then you can use the XML syntax. Otherwise, you'll need to paste in the characters from a character map.
Grahame Grieve (Feb 01 2019 at 04:26):
this is fatal. Very very fatal. We cannot recommend let alone require schema regex
Bryn Rhodes (Feb 01 2019 at 04:27):
Yeah, it seems very specific to supporting XML.
Bryn Rhodes (Feb 01 2019 at 04:31):
I think it depends on your platform and requiring support for a particular flavor would be onerous.
Bryn Rhodes (Feb 01 2019 at 04:32):
We should change the recommended one to PCRE
Bryn Rhodes (Feb 01 2019 at 04:32):
Or the ECMAScript one that's part of JavaScript.
Grahame Grieve (Feb 01 2019 at 04:34):
PCRE works for me
Paul Lynch (Feb 01 2019 at 16:02):
It looks like PCRE is not what web browsers use. Browsers may eventually catch up, and there are some packages to translate PCRE (https://github.com/TooTallNate/pcre-to-regexp, https://medium.com/@DmitrySoshnikov/using-modern-regexes-in-javascript-30322af557c5) but they are not complete solutions.
Last updated: Apr 12 2022 at 19:14 UTC