|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] contains and tokenizeDavid Carlisle davidc at nag.co.ukMon Oct 23 17:10:29 PDT 2006
you could use matches instead of contains and add some word boundaries to your regex. Schema/xpath regexp don't have built in word boundary excpressions, but depending on your language rules something like matches($text,concat('(^|[ ,\.;])',$keyword,($|[ ,\.;])'),'i') for a case insensitive match against the keyword combined with either the beginning or end of a string or a space , or ;. If you want to use tokenize then you want = not contains, something like upper-case($keyword) = tokenize(upper-case($text),'(\s|[\.,;])+' which returns the sequence of words and then tests if any of them is equal to the keyword. (There are some differences, a case insenitive match for example isn't the same thing as upper casing and then comparing, see http://www.w3.org/TR/xpath-functions/#flags ) David
|
Purchase Stylus Studio Online Today!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






