Please help with regular expression

  • Thread starter Thread starter paulsmith5
  • Start date Start date
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
 
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
 
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

Back
Top