[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: java Regex call

Subject: Re: java Regex call
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Thu, 10 Jul 2003 12:05:54 +0100
java matches
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.