[XSL-LIST Mailing List Archive Home]
Re: [xsl] java Regex call
Subject: Re: [xsl] java Regex call|
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 10 Jul 2003 12:05:54 +0100
> Why are there two lots of output please?
The <xsl:analyze-string> element works through the string that you
select (in this case 'ABC_PARA__PARA') and splits it into matching and
non-matching substrings based on the regular expression that you use
(in this case '(([^_]*)_PARA)').
Starting with the string:
the first substring that matches (([^_]*)_PARA) is:
This starts at the first character of the string, so there's no
non-matching substring before it. The group [^_]* matches the
substring 'ABC', and the remainder of the regular expression matches
The substring that's left after this first match is:
The first substring of this that matches (([^_]*)_PARA) is:
This doesn't start at the first character, so there's a non-matching
substring of '_' first.
In the matching substring, the group [^_]* doesn't match anything
(which is OK, the * means that that it doesn't have to), and the
remainder of the regular expression matches '_PARA'.
So the string is broken into two matching substrings ('ABC_PARA' and
'_PARA') with a non-matching substring of '_' in between. And you get
two lots of output because you're generating one for each of the
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list