I am trying an XQuery using fn:matches
with a regular expression, but the MarkLogic implementation of XQuery does not seem to allow hexidecimal character representations. The following gives me an "Invalid regular expression" error.
(: Find text containing non-ISO-Latin characters :)
let $regex := '[^\x00-\xFF]'
let $results := fn:collection('mydocs')//myns:myelem[fn:matches(., $regex)]
let $count := fn:count($results)
return
<figures count="{$count}">
{ $results }
</figures>
However, this one does not give the error.
let $regex := '[^a-zA-Z0-9]'
let $results := fn:collection('mydocs')//myns:myelem[fn:matches(., $regex)]
let $count := fn:count($results)
return
<figures count="{$count}">
{ $results }
</figures>
Is there a way to use the hexidecimal character representation, or an alternative that would give me the same result, in MarkLogic's implementation of XQuery?
let $regex := '[^\x00\xFF]'
If it runs, it means you have a problem with the range. If it doesn't run, then MarkLogic regex will appear to not accept hexadecimal matches. – Oyler\[a-z\]
others might need[\x{00}]
. It'll be hard to test without an actual MarkLogic console in front of me. – Oyler[[:ascii:]]
class in MarkLogic regex? In your first example, you are essentially trying to match any ASCII character. – Oyler