ValidationExpression

M

metridevkk

Hi,
I have attached a RegularExpressionValidator Control to a textbox to accept
numeric values in the format:

###*#####*##

I have entered the following regex in the ValidationExpression:

[0-9]{3}\*[0-9]{5}\*[0-9]{2}
or
[0-9]{3}[\*][0-9]{5}[\*][0-9]{2}

but validator fails to validate an input such as:

111*11111*11

Could someone please guide me on what is wrong in the regular expression
that i have specified?

Thanks.
 
M

metridevkk

Interestingly, my expression:

[0-9]{3}\*[0-9]{5}\*[0-9]{2}

worked on another machine. But on my machine it does not validate the input
in the browser. Vey wierd.

I tried your expression on my machine, but the validator(at design time)
wouldn't accept & said "Invalid property value: \d{3}*\d{5}*\d{2} is not a
valid regular expression". Mayme it will work on the other machine. If so,
then something wrong on my machine only:).

Thanks



Scott M. said:
\d{3}*\d{5}*\d{2}


metridevkk said:
Hi,
I have attached a RegularExpressionValidator Control to a textbox to
accept
numeric values in the format:

###*#####*##

I have entered the following regex in the ValidationExpression:

[0-9]{3}\*[0-9]{5}\*[0-9]{2}
or
[0-9]{3}[\*][0-9]{5}[\*][0-9]{2}

but validator fails to validate an input such as:

111*11111*11

Could someone please guide me on what is wrong in the regular expression
that i have specified?

Thanks.
 
S

Scott M.

Sorry about that. The asterisk char needs to be escaped because it is a
reserved char. This works:

\d{3}\*\d{5}\*\d{2}


metridevkk said:
Interestingly, my expression:

[0-9]{3}\*[0-9]{5}\*[0-9]{2}

worked on another machine. But on my machine it does not validate the
input
in the browser. Vey wierd.

I tried your expression on my machine, but the validator(at design time)
wouldn't accept & said "Invalid property value: \d{3}*\d{5}*\d{2} is not a
valid regular expression". Mayme it will work on the other machine. If so,
then something wrong on my machine only:).

Thanks



Scott M. said:
\d{3}*\d{5}*\d{2}


metridevkk said:
Hi,
I have attached a RegularExpressionValidator Control to a textbox to
accept
numeric values in the format:

###*#####*##

I have entered the following regex in the ValidationExpression:

[0-9]{3}\*[0-9]{5}\*[0-9]{2}
or
[0-9]{3}[\*][0-9]{5}[\*][0-9]{2}

but validator fails to validate an input such as:

111*11111*11

Could someone please guide me on what is wrong in the regular
expression
that i have specified?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top