Hi, Oleksii:

Regarding question 2, aside from a few edge cases,
the MarkLogic libraries have the same core implementation
with JavaScript and XQuery interfaces.

The core behavior of functions in the MarkLogic libraries are
(in almost every case) consistent across environments.

If you are working in JavaScript and the regex implementation
from v8 is a good fit for your requirements, you should take
advantage of JavaScript regex objects and methods.


Hoping that clarifies,


Erik Hennum


________________________________
From: general-boun...@developer.marklogic.com 
[general-boun...@developer.marklogic.com] on behalf of Sewell, David R. (drs2n) 
[dsew...@virginia.edu]
Sent: Wednesday, March 22, 2017 1:40 PM
To: MarkLogic Developer Discussion
Subject: Re: [MarkLogic Dev General] Regular Expressions

I’m not sure what the answer is to question 2, but for question 1, the answer 
is that MarkLogic’s implementation of XPath doesn’t support the \b character 
escape because it is not included in the  XPath specification for regular 
expressions, which itself is based on "XML Schema Part 2: Datatypes Second 
Edition”. The only single-character escapes are these:

https://www.w3.org/TR/xmlschema-2/#nt-charClassEsc

Some XSLT and XQuery processors support extended regular expressions as a 
proprietary feature (for example, Saxon has a semi-documented extension that 
allows full Java regex), but MarkLogic doesn’t (unless there is undocumented 
support that I don’t know about).

David

On Mar 22, 2017, at 3:55 PM, Oleksii Segeda 
<oseg...@worldbankgroup.org<mailto:oseg...@worldbankgroup.org>> wrote:

Hi everyone,

Quick questions regarding regex in ML:

1.       What’s ML alternative to word boundaries \b? Seems that 
fn:analyze-string doesn’t support this special character.
2.       Does  JS version of this function (fn.analyzeString) use JS regex 
engine? If so, why it gives me error for fn.analyzeString("foo bar bar", 
"\\b<UrlBlockedError.aspx>(bar)\\b") ?

Regards,

Oleksii Segeda

IT Analyst

Information and Technology Solutions

<image002.png>

<image003.png>



_______________________________________________
General mailing list
General@developer.marklogic.com<mailto:General@developer.marklogic.com>
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
General@developer.marklogic.com
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to