[xsl] java Regex call

Subject: [xsl] java Regex call
From: John Sharp <jsharp@xxxxxx>
Date: Wed, 09 Jul 2003 17:46:58 -0500
Hi, Does anyone have an example of using the java.util.regex
functions to return the "components" of the regex that matched.

Example: if my regex is defined as:-


 and my input is "ABC_PARA"

 Then I need to know what portions of the input matched
 each (if any) part of the regex groups, ([^_]*) and (.*?) etc,.
 in terms of group number and matching string.

 Something like  "ABC" matched in group 4

I can use the following to find if I have a match, but can't 
seem to get to the next stage...

  <xsl:for-each select="$rule//Type">  
    <xsl:variable name="tdlType" select="."/>
        <xsl:when test="regex:matches($regex, $tdlType)">
          <xsl:variable name="ruleName" select="$rule//@name"/>
          <RULE_MATCH><xsl:value-of select="$ruleName"/></RULE_MATCH>
          <xsl:copy-of select="$regex"/>

Also, I'm using the Saxon 7.6  processor.

Thanks, John.

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread