[xquery-talk] string manipulation

Florent Georges darkman_spam at yahoo.fr
Sun Feb 5 23:41:50 PST 2006

Florent Georges wrote:

> John Snelson wrote:

> > "*?" is a reluctant version of the "*" quantifier, meaning
> > it matches the shortest sequence, rather than the longest.
> > My regular expression works because of this - but yours will
> > work as well.

>   Ok, thanks, I didn't know that.  BTW, Saxon 8.6.1 doesn't
> implement this correctly.  I'll send a bug report.

  Here is the response from Michael Kay

    No, the "?" quantifier will match the shortest string
    that's consistent with the rest of the regex (to the
    right) finding a match, but it doesn't affect what's
    matched by previous terms in the regex. The "/" in /.*?$
    will always match the first "/" in the input string
    provided that what comes after it matches .*?$. The
    regex will only backtrack to find a different match for
    the "/" if the first match fails. Or to look at it
    another way, if there are several possible matches both
    starting at the same position, .*? will choose the
    shortest while .* chooses the longest.




Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international.
Téléchargez sur http://fr.messenger.yahoo.com

More information about the talk mailing list