RE: [xsl] two regexp related questions

Subject: RE: [xsl] two regexp related questions
From: Tony Nassar <tnassar@xxxxxxxxxxxx>
Date: Thu, 19 May 2011 11:18:50 -0700
If you're on XSLT 2.0, you really want to be using <xsl:analyze-string> for
this.

________________________________________
From: Julian Reschke [julian.reschke@xxxxxx]
Sent: Thursday, May 19, 2011 1:45 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: [xsl] two regexp related questions

Hi there,

I've got two regexp-related questions.

1) Is it correct that XSLT/XPath2's regular expressions do not support
non-capturing groups (as shown in
<http://www.exampledepot.com/egs/java.util.regex/NoGroup.html>)?

2) With respect to analyze-string, and the captured regex-groups:

I'm using a regex like

   ([A-Z]+) = ([A-Z]+) ( ; ([A-Z]+) = ([A-Z]+) )*

for matching things like

   a=b;c=d;e=f

Works fine, but the regex-group function only returns values for the
last match, so, with the example above, I can capture

  a=b (because it's a non-repeating part)

and

  e=f

I've worked around this by using recursion, feeding the "remainder" into
another template.

Is there a simpler way to achieve this?

Best regards, Julian

Current Thread