logo       

matches() function: msg#00210

text.xml.exist

Subject: matches() function

Hi,

I've been trying to get the matches() function to work in the beta release, and to my mind it seems to be broken:

matches("hello world", "hello") returns false
matches("hello world", "hello world") returns true
matches("hello world", "hello.*") returns true

The second string is matched against the *entire* first string

this is different to the behaviour of replace:

replace("hello world", "hello", "goodbye") returns "goodbye world"

<http://www.w3.org/TR/xquery-operators/#func-matches>
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)."

This (broken?) behaviour is true on the <http://demo.exist-db.org/exist/xquery/xquery.xq> which appears to be built on a recent snapshot.

Am I mistaken about the expected behaviour of this function, or is it a bug that needs fixing?

Jonathan

Jonathan Miller
Learning Technologies Group
Oxford University Computing Services
13 Banbury Road, Oxford, OX2 6NN. Tel +44 (0)1865 283400
http://www.w3.org/TR/xquery-operators/#func-matches



-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise