Re: why matches($title,'.*?(\.|,)\s*$')) can perform s
That is interesting. I was aware that there are some very smart regex engines out there, but wasn't aware that they had made it to any XQuery/XSLT processors yet.
Another interesting article is this one describing some of the optimizations performed by the regex engine in Google Chrome: http://blog.chromium.org/2009/02/irregexp-google-chromes-new-regexp.html
This mentions another trick used by some regex implementations. In their example "Sun|Mon", their engine recognises that a match for this expression always contains "n" in the third character, and so rather than testing for a match at each index in the string (which was the problem with the example given) they first scan the string to find "n" characters and only try to apply the regex starting two characters preceding one. I would not be at all suprised if they recognized that a regex beginning .* needs only be applied to the first character.
On 13/07/2011 15:13, Michael Kay wrote:
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