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

Re: [xsl] Any likely prospect of lookahead/ lookbehind regex support in future XPath/XSLT?


Subject: Re: [xsl] Any likely prospect of lookahead/ lookbehind regex support in future XPath/XSLT?
From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 16 May 2014 18:01:13 -0000

It does no harm to ask. Raise the request as a formal comment on the XPath 3.1
specification.

I don't think anyone will object on principle, provided that the extension is
well-defined in terms of Unicode, easy to specify, and widely available in
regex libraries. They may object on the grounds of resources and timescales.

Michael Kay
Saxonica

On 16 May 2014, at 17:26, David Sewell dsewell@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> I'm guessing that the answer is going to be "no", but am just wondering
whether there has been discussion of extending the standard regular expression
support in XPath to include lookahead and lookbehind assertions (both positive
and negative). I'm also guessing that this could be more than a little tricky
for implementors.
>
> Every now and then I find cases where replacement or xsl:analyze-string are
made hugely easier by availability of those features. For example, at the
moment I'm doing a transform to convert text like
>
>  VIII, 9, 150 n. 4, 179-80 and n. 3
>
> into something like
>
> <num value="8">VIII</num>, <num n="pg">9</num>, <num n="pg">150</num> n. 4,
<num n="pg">179-80</num> and n. 3
>
> so that I can create links to the pages and page ranges. It's a lot more
straightforward to do via xsl:analyze-string when I can use a negative
lookbehind assertion to ignore numerals preceded by "n. ".
>
> I appreciate the ability to do this in Saxon via an (unsupported) extension,
but having it part of the standard would mean less worry about whether code
that works now might not work later.
>
> David
>
> --
> David Sewell, Editorial and Technical Manager
> ROTUNDA, The University of Virginia Press
> PO Box 400314, Charlottesville, VA 22904-4314 USA
> Email: dsewell@xxxxxxxxxxxx   Tel: +1 434 924 9973
> Web: http://rotunda.upress.virginia.edu/


Current Thread
Keywords