|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: java Regex call
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
|
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
|

Cart








