[had to fish this one out of spam]
On Thu, Nov 03, 2022 at 06:12:02PM -0400, Liam R. E. Quin scripsit:
On Thu, 2022-11-03 at 15:00 -0400, Graydon Saunders wrote:
You can (I think) test if some attribute value is an RFC 4122 UUID by using a regular expression:
let $regexp as xs:string := '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-5][0-9a-fA-F]{3}-[089abAB][0-9a- fA-F]{3}-[0-9a-fA-F]{12}$'
[snip more structured approach to writing the regular expression]
Mike Kay gives a solution [1],
translate($in, '0123456789abcdefABCDEF', '000000000000000000000000') = '00000000-0000-0000-0000-000000000000'
which is probably enough in practice.
Elegant! thank you! That's probably the least expensive one yet.
If you need to check further, see RFC 4122 for the components. Your regexp limits the UUID value space https://datatracker.ietf.org/doc/html/rfc4122#page-5
Noted, thank you!
(I am thankfully at the proof-of-concept stage.)