| Subject: Re: [xsl] java Regex call From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx> Date: Thu, 10 Jul 2003 12:05:54 +0100 | 
Hi Dave,
> 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:
  ABC_PARA__PARA
the first substring that matches (([^_]*)_PARA) is:
  ABC_PARA__PARA
  ^^^^^^^^
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
'_PARA'.
The substring that's left after this first match is:
  __PARA
The first substring of this that matches (([^_]*)_PARA) is:
  __PARA
   ^^^^^
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
matching substrings.
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
| Current Thread | 
|---|
| 
 | 
| <- Previous | Index | Next -> | 
|---|---|---|
| RE: [xsl] java Regex call, David . Pawson | Thread | RE: [xsl] java Regex call, David . Pawson | 
| RE: [xsl] java Regex call, Michael Kay | Date | RE: [xsl] java Regex call, David . Pawson | 
| Month |