Yeah, basically replace . with \., and * with .*, and ? with .?

And maybe escape some more chars like ( and [..

From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Dave Cassel 
<[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Thursday, February 4, 2016 at 4:15 PM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: Re: [MarkLogic Dev General] URI pattern match function

I don't think so, but changing a URI pattern to a proper regex is pretty 
straightforward:

let $str := '/foo/stuff/bar-none.xml'
return fn:matches($str, '/foo/.*/bar-.*\.xml')
=> true

--
Dave Cassel<http://davidcassel.net>, @dmcassel<https://twitter.com/dmcassel>
Technical Community Manager
MarkLogic Corporation<http://www.marklogic.com/>
http://developer.marklogic.com/


From: 
<[email protected]<mailto:[email protected]>>
 on behalf of Florent Georges <[email protected]<mailto:[email protected]>>
Reply-To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Date: Thursday, February 4, 2016 at 9:37 AM
To: MarkLogic Developer Discussion 
<[email protected]<mailto:[email protected]>>
Subject: [MarkLogic Dev General] URI pattern match function

Hi,

The function cts:uri-matches takes a URI pattern as a parameter.
Something that looks a bit like a file glob in Shell:
/foo/*/bar-*.xml.

Is there a function that returns whether a given string matches such a
pattern?  A bit like fn:matches, but for a URI pattern instead of a
proper regex.

Regards,

--
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to