Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - xslt 2.0 regex iterate over captured substrings ==> regex-group(n) [Thread Next] Re: xslt 2.0 regex iterate over captured substrings ==> regex-group(n)To: NULL Date: 6/7/2009 2:05:00 PM RolfK wrote: > I got a regex which returns many captured subtrings. > My problem is that the regex is not in my hand and I need to iterate > over all cpatured substring items by the regex-group() function. This > function requires an integer argument. Unfortunately I do not know the > maximum index. > > Actually I need simply to conctinate all matching substrings. But as > the max index is not known I can not do this. > > What is the solution to that ? You could use a sufficiently large enough number e.g. 200 if you assume there are not more than 200 groups and do string-join(for $g in 1 to 200 return regex-group($g), '') that would concatenate all subgroups from 1 to 200 and as regex-group(someIndex) of a not existing index or not matching index gives a zero-length string that shouldn't change the result. -- Martin Honnen http://msmvps.com/blogs/martin_honnen/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
