Thanks for your reply
But metacharacter addition not working it is behaving like ,
This statement is returning fn:matches("I am learning regex","^re$") false
(expected)
But this statement is returning fn:matches("I am learning re","^re$") false
(unexpected) but I am expecting true for the same.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Christopher Hamlin
Sent: Friday, October 13, 2017 3:26 PM
To: MarkLogic Developer Discussion <[email protected]>
Subject: Re: [MarkLogic Dev General] exact match using regex
You can use anchors, as
fn:matches("I am learning regex","^re$")
7.6.2 fn:matches of https://www.w3.org/TR/xpath-functions/#flags says:
Unless the metacharacters ^ and $ are used as anchors, the string is considered
to match the pattern if any substring matches the pattern.
But if anchors are used, the anchors must match the start/end of the string (in
string mode), or the start/end of a line (in multiline mode).
Note:
This is different from the behavior of patterns in [XML Schema Part 2:
Datatypes Second Edition], where regular expressions are implicitly anchored.
On Fri, Oct 13, 2017 at 3:19 PM, <[email protected]> wrote:
> Hi All,
>
>
>
> How to match exact word using fn:matches and regex.
>
>
>
> Example : fn:matches(“I am learning regex”,”re”)
>
> Above statement returning true as it is matching with “regex” but I
> want it should match only when string found exact keyword.
>
>
>
> Regards,
>
> Vikas Singh
>
>
>
> This e-mail and any files transmitted with it are for the sole use of
> the intended recipient(s) and may contain confidential and privileged
> information. If you are not the intended recipient(s), please reply to
> the sender and destroy all copies of the original message. Any
> unauthorized review, use, disclosure, dissemination, forwarding,
> printing or copying of this email, and/or any action taken in reliance
> on the contents of this e-mail is strictly prohibited and may be
> unlawful. Where permitted by applicable law, this e-mail and other
> e-mail communications sent to and from Cognizant e-mail addresses may be
> monitored.
>
> _______________________________________________
> General mailing list
> [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
This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged information.
If you are not the intended recipient(s), please reply to the sender and
destroy all copies of the original message. Any unauthorized review, use,
disclosure, dissemination, forwarding, printing or copying of this email,
and/or any action taken in reliance on the contents of this e-mail is strictly
prohibited and may be unlawful. Where permitted by applicable law, this e-mail
and other e-mail communications sent to and from Cognizant e-mail addresses may
be monitored.
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general