This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
The EXSLT community (http://exslt.org/) has defined an XSLT function named regexp:replace() (http://exslt.org/regexp/functions/replace/index.html) which is similar in purpose to our function fn:replace(). The two functions have different signatures and slightly different semantics. EXSLT's regexp:replace() function supports a flag that sets its behavior to replace-all-matches vs. replace-first-match-only (fn:replace() currently supports only the first of these behaviors and has no corresponding flag.) For users of the EXSLT function who wish to migrate to XQuery or XSLT 2.0, it would be helpful to add an additional flag to fn:replace() that provides similar functionality. I request that the joint working groups consider this additional parameter as a possible future extension to fn:replace().
Enhancement request: Recategorized under F+O version 1.1
I believe this requirement is satisfied by the new analyze-string() function. For example, to wrap parentheses around the first sequence of numeric digits in a string, one could write: let $x := analyze-string($in, '\d+') return string-join( for $s in $x return (if ($s is $x/match[1]) then concat('(', ., ')') else string(.)) I am accordingly marking this as fixed; please feel free to reopen if you feel this is not an adequate solution to the requirement.
Since the requested functionality is provided by the new analyze-string() function, I am marking this closed.