You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Bakul Kumar <ba...@gmail.com> on 2007/07/02 14:23:27 UTC

Validation Reg ex of ( ).

Hi,

I want to validate the telephone number. I want to allow 0-9, *, +,-,(,
SPACE and ).
That means it should allow : (240) 643-9325

For that I tried :
                <var>
                    <var-name>mask</var-name>
                    <var-value>^[0-9()x+. -]*$</var-value>
                </var>

This is working fine. But, I don't have any control in RegEx to check
whether user has entered valid set of '(' and ')'. I mean, its allowing  :
(240( 643-9325 as a valid number.

If you have an idea of how to check the sequece of brackets '(' and ')'.
Please share it with me.

regards,
Bakul.

Re: Validation Reg ex of ( ).

Posted by Niall Pemberton <ni...@gmail.com>.
On 7/2/07, Bakul Kumar <ba...@gmail.com> wrote:
> Hi,
>
> I want to validate the telephone number. I want to allow 0-9, *, +,-,(,
> SPACE and ).
> That means it should allow : (240) 643-9325
>
> For that I tried :
>                 <var>
>                     <var-name>mask</var-name>
>                     <var-value>^[0-9()x+. -]*$</var-value>
>                 </var>
>
> This is working fine. But, I don't have any control in RegEx to check
> whether user has entered valid set of '(' and ')'. I mean, its allowing  :
> (240( 643-9325 as a valid number.
>
> If you have an idea of how to check the sequece of brackets '(' and ')'.
> Please share it with me.

Probably best to google for help on this - or as on a mailing list
related to regular expressions:

http://tinyurl.com/3avnu9

Niall

> regards,
> Bakul.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org