xsl-list
[Top] [All Lists]

Re: Aw: [xsl] a sequence of regex-group()

2015-10-28 16:11:25
Thanks Martin, 
That would definitely be a solution in an XSLT3 context (however this is XSLT2) 


----- Original Message -----

From: "Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de" 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
Sent: Wednesday, October 28, 2015 9:52:56 PM 
Subject: Aw: [xsl] a sequence of regex-group() 

It sounds as if http://www.w3.org/TR/xpath-functions-30/#func-analyze-string 
might allow better control about matches and captured groups as it returns all 
imformation as XML. 
-- 
Diese Nachricht wurde von meinem Android Mobiltelefon mit GMX Mail gesendet. 



"Geert Bormans geert(_at_)gbormans(_dot_)telenet(_dot_)be" 
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com>schrieb: 


Hi all, 

sanity check 

If I wanted a sequence of all the regex-group() values available in a 
matching-substring... 

(This is inside a function and the actual regex $re is passed in as a param, so 
number of item() is unknown) 

I expected this to be somewhat more straightforward than this, so I check 

<xsl:variable name="group-count" select="string-length(replace($re, '[^\(]+', 
''))"/> 
<xsl:analyze-string select="$str" regex="{$re}"> 
<xsl:matching-substring> 
<xsl:variable name="re-groups" select="for $i in 1 to $group-count return 
regex-group($i)" as="item()*"/> 


Any thoughts? 

Thanks a lot 

Geert 
XSL-List info and archive 
EasyUnsubscribe ( by email ) 



XSL-List info and archive 
EasyUnsubscribe ( by email ) 
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>
  • Re: Aw: [xsl] a sequence of regex-group(), Geert Bormans geert(_at_)gbormans(_dot_)telenet(_dot_)be <=