Re: [xsl] lookaheads in XSLT2 regexes

Subject: Re: [xsl] lookaheads in XSLT2 regexes
From: "Imsieke, Gerrit, le-tex" <gerrit.imsieke@xxxxxxxxx>
Date: Fri, 26 Feb 2010 20:57:49 +0100
That's great news! With the '!' flag, the much-missed '\b' (word boundary) works. Using it seems safe, at least compared to groups or lookaheads. If you don't discontinue the '!' flag, it will be as stable as Java regexes.

Gerrit

On 26.02.2010 19:21, Michael Kay wrote:
If you're completely stuck, there's an undocumented, largely untested, and
completely non-conformant option in Saxon - if the flags attribute starts
with "!", you can use full Java regular expression syntax in the regex
attribute. This may not work perfectly, for example it may disrupt the
counting of captured groups in regex-group().

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay

-----Original Message-----
From: james@xxxxxxxxxxxxxxxxx
[mailto:james@xxxxxxxxxxxxxxxxx] On Behalf Of James Cummings
Sent: 26 February 2010 18:07
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] lookaheads in XSLT2 regexes

On Fri, Feb 26, 2010 at 17:29, Martin Honnen
<Martin.Honnen@xxxxxx>  wrote:
No, as far as I know and as far as
http://www.w3.org/TR/xquery-operators/#regex-syntax describes those
constructs do not exist in the regular expression language
that XPath
2.0 and XSLT 2.0 use.

I thought that was what you were going to say (and I should have just looked at the spec before posting, mea culpa). I can't think of any other way to do this with the analyze-string recursive replacing with xsl:sequence...and I'm loathe to change that much since it is working fine! I suppose one answer is to transform the input so it has better/more/different delimiters of some sort, but I'll have to think that through.

Ah well,
-James


-- Gerrit Imsieke Geschdftsf|hrer / Managing Director le-tex publishing services GmbH Weissenfelser Str. 84, 04229 Leipzig, Germany Phone +49 341 355356 110, Fax +49 341 355356 510 gerrit.imsieke@xxxxxxxxx, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschdftsf|hrer: Gerrit Imsieke, Svea Jelonek,
Thomas Schmidt, Dr. Reinhard Vvckler

Current Thread