Re: Regular expression functions (Was: Re: [xsl] comments on December F&O draft)

Subject: Re: Regular expression functions (Was: Re: [xsl] comments on December F&O draft)
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 10 Jan 2002 11:23:47 GMT
Jeni

  - introducing a syntax for naming the subexpressions rather than
    numbering them

this works surprisingly well in omnimark, although I thought it odd when
I first saw it. It also allows you to grab nested strings rather than
having to reconcatenate #1 #2 etc for example (in a mixture of omnimark
and sed/perl syntax)

given ([a-z])([a-z0-9]*) matching an identifier starting with a letter
and going on with letters and numbers you can given numered
subexpressions get hold of $1 and $2 to get the two parts but if you
also need the full identifier you have to concat them back together
again. but omnimark allows something more like
 ( ([a-z]) => first-letter ([a-z0-9]*) => following-letters-digits ) => the-whole-thing

then you can use $first-letter, $following-letters-digits and $the-whole-thing
in the code that is triggered by the match. 
(In Omnimark regexps white space is always ignored, you have to use a
special term to match white space, which allows these variable binding
clauses to be freely inserted anywhere inside the regexp, more or less)

> - I don't think that, at least in XSLT 2.0, this should necessarily be
> introduced because it's just a convenience (that leads to lots of
> other inconveniences!) rather than essential functionality.

agreed, although one nice effect is that it allows you to keep variable
names being qnames.

David

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread