Re: [xsl] lookaheads in XSLT2 regexes

Subject: Re: [xsl] lookaheads in XSLT2 regexes
From: James Cummings <james+xsl@xxxxxxxxxxxxxxxxx>
Date: Mon, 1 Mar 2010 10:59:37 +0000
On Fri, Feb 26, 2010 at 18:21, Michael Kay <mike@xxxxxxxxxxxx> 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().

This sounds like just what I want.  It isn't for a production system,
and one step in a pipeline of transformations for a one-off
conversion.  However I have a problem:  When I put ! into the flags
attribute of analyze-string I get the following error:

 FORX0001: Invalid character '!' in regular expression flags

from:

 <xsl:analyze-string select="$str" regex="{$abbr[1]}" flags="!">

This is with: Saxon-HE 9.2.0.6J and Java(TM) SE Runtime Environment
(build 1.6.0_14-b08)

Any suggestions what I'm doing wrong.  (I didn't even notice the
@flags attribute before, so at least have learned something new
today.)

Many thanks,

-James

Current Thread