Re: two regexp related questions
For 2), if you're using the regex to both validate the input (making sure it conforms to the required syntax) and parse/extract the name/value pairs, you might be able to make the job easier by breaking these two tasks apart. Use the regex as you have it now to validate the input and then, if it matches, use a shorter regex that matches just a single name/value pair with analyze-string to do the actual processing. -Brandon :) On Thu, May 19, 2011 at 1:45 PM, Julian Reschke <julian.reschke@xxxxxx> wrote: > 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
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format