Hi,
.*? seems a little strange to me as a construct -- .* is 'zero or more
occurances of any character', no? And a ? means zero or one occurrence. So I
think you may have confused the regex library (and one recovers differently
than the other). I think you'll find "^(\\w+)\\s*=\\s*(.*)\\;$" works as well.
Chris
-----Original Message-----
From: Shishir K. Singh [mailto:[EMAIL PROTECTED]
Sent: Monday, June 23, 2003 8:57 AM
To: [EMAIL PROTECTED]
Subject: RE: org.apache.xerces.utils.regex help
Follow up on my own question:
If I use the following expression, I get the desired result:
RegularExpression re = new RegularExpression("^(\\w+)\\s*?=\\s*?(.*?)\\;$");
Why is it that using (.*?) twice is not producing the desired result ? Is this
a bug or a feature ?
TIA
Shishir
> -----Original Message-----
> From: Shishir K. Singh
> Sent: Monday, June 23, 2003 10:41 AM
> To: '[EMAIL PROTECTED]'
> Subject: org.apache.xerces.utils.regex help
>
> Hi,
>
>
> My intent is to parse the property file like
>
> AAAAAA = BBBBBBB;
> XXXXXX = "YYYYYY";
>
> I am using the following expression which works fine with the
> java.util.regex package Java 1.4 (I have to do the same on Java 1.3).
>
> RegularExpression re = new
> RegularExpression("^(.*?)\\s*?=\\s*?(.*?)\\;$");
> Match mat = new Match();
> boolean m = re.matches(line,md);
>
> I want to get to the two group to get the key/value pair.
>
> The return value of m is false.
>
> Is there something wrong with the expression ?
>
>
>
> TIA
> Shishir
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]