Please help with regular expression

P

paulsmith5

Hi,

Not sure if this is the correct ng for posting this question but I am
using aspx and I couldn't find a more suitable alternative. Anyway I'm
developing a web app and I want to validate a users input on a form. I
need a regular expression to validate a string which must be from 1 to
5 characters in length - each character must be a number from 0 to 9
however the string can't be comprised entirely of 0's (i.e. invalid
entries would be 0, 00, 000, 0000, and 00000)

Hope someone can help.

Thanks,

Paul
 
K

Kris

Hello Paul,

Easy way would be validate in the Javascript code.

1. Check whether the user input is a number or not.
2. Ensure the number is between 1 - 99999 range.

Cheers,
Kris
 
H

Hans Kesting

Hi,
Not sure if this is the correct ng for posting this question but I am
using aspx and I couldn't find a more suitable alternative. Anyway I'm
developing a web app and I want to validate a users input on a form. I
need a regular expression to validate a string which must be from 1 to
5 characters in length - each character must be a number from 0 to 9
however the string can't be comprised entirely of 0's (i.e. invalid
entries would be 0, 00, 000, 0000, and 00000)

Hope someone can help.

Thanks,

Paul

Why not use a RangeValidator?
Set the Type to (ValidationDataType.)Integer, MinimumValue to 1 and
MaximumValue to 99999.

Hans Kesting
 

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

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top