You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-user@jakarta.apache.org by Eitan Katznelson <ei...@quimbik.com> on 2002/01/16 23:17:05 UTC

Correct me if im wrong

Hi,

I am using the reg-exp1.2 libraries and the following regular expression:
^([0-9]?[0-9]?[0-9](,[0-9]{3})+)|([0-9]+)$
to match user input for validation (Basically a positive number possibly
with commas).

when I run the input 123,12 it is accepted
when I run the input 123,123a it is accepted
when I run the input 123,12a it is rejected.

>From what I know about regular expressions none of the above should match,

Can anyone explain why this is happening??

Thanks,
Eitan



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Correct me if im wrong

Posted by Eitan Katznelson <ei...@quimbik.com>.
I was wrong,
I forgot that the "^$" symbols are part of the expression, and thus I needed
an extra set of parens around everything but those two characters to get the
desired result.

Sorry for the trouble,
Eitan


-----Original Message-----
From: Eitan Katznelson [mailto:eitank@quimbik.com]
Sent: Wednesday, January 16, 2002 2:17 PM
To: regexp-user@jakarta.apache.org
Subject: Correct me if im wrong


Hi,

I am using the reg-exp1.2 libraries and the following regular expression:
^([0-9]?[0-9]?[0-9](,[0-9]{3})+)|([0-9]+)$
to match user input for validation (Basically a positive number possibly
with commas).

when I run the input 123,12 it is accepted
when I run the input 123,123a it is accepted
when I run the input 123,12a it is rejected.

>>From what I know about regular expressions none of the above should match,

Can anyone explain why this is happening??

Thanks,
Eitan



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>