Regular expression with numbers

  • Thread starter Thread starter Beffmans
  • Start date Start date
B

Beffmans

Hi

I want to make a regularexpressionvalidator for a textbox to allow only
numbers but not a specified number of digits

How to do this?

ch B
 
Please chcek ASPNET account permission on application_start in your global
asax file.
FileIOPermission MyPermission = new
FileIOPermission(FileIOPermissionAccess.Write,
HttpContext.Current.Request.PhysicalApplicationPath);
try {
MyPermission.Demand();
}
catch(Exception ex) {
// You can tell your client that ASPNET Account does not have rights to the
filesystem.
// or redirect error page now.
}
 
Beffmans said:
Hi

I want to make a regularexpressionvalidator for a textbox to allow
only numbers but not a specified number of digits

How to do this?

ch B

^( [0-9]{,5} | [0-9]{7,} )$

zero to 5 numbers, or 7 or more numbers
(note: remove the spaces, they were added for readability)

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

Similar Threads


Back
Top