W3C home > Mailing lists > Public > public-qt-comments@w3.org > November 2004

Re: [F&O] regular expressions: non-capturing groups

From: Tobias Reif <tobiasreif@pinkjuice.com>
Date: Tue, 23 Nov 2004 17:38:20 +0100
To: David Carlisle <davidc@nag.co.uk>
Cc: tobiasreif@pinkjuice.com, public-qt-comments@w3.org
Message-ID: <20041123163820.GA2498@linux.local>

Hi David

On Tue 2004-11-23 David Carlisle wrote:
[...]
> In this case you don't need non capturing groups, you can just grab all
> potential keywords (eg [a-z]+) in the analyze-string, then test to see
> what you have before deciding whether to add the keyword markup, eg
> changing your code to
> <xsl:template match="programlisting[@role='pseudocode']/text()">
>   <xsl:analyze-string select="."  regex="[a-z]+">
>     <xsl:matching-substring>
>        <xsl:choose>
>       <xsl:when test=". = ('while','true','if','else','end')">
>       <span class="keyword">
[...]

Thanks, I'll see how far that gets me (there are more complex cases,
where non-capturing groups probably would be handy).

Tobi

-- 
to
  bi
    as
  re
if
Received on Tuesday, 23 November 2004 16:38:17 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 16:57:02 UTC