[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] lookaheads in XSLT2 regexes


Subject: RE: [xsl] lookaheads in XSLT2 regexes
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 26 Feb 2010 18:21:20 -0000

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


Current Thread
Keywords