473,385 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Please help with regular expression

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

Feb 17 '06 #1
3 919
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

Feb 17 '06 #2
> 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
Feb 17 '06 #3
Yes.

RangeValidator would be good option.

Feb 17 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bradley Plett | last post by:
I'm hopeless at regular expressions (I just don't use them often enough to gain/maintain knowledge), but I need one now and am looking for help. I need to parse through a document to find a URL,...
4
by: Neri | last post by:
Some document processing program I write has to deal with documents that have headers and footers that are unnecessary for the main processing part. Therefore, I'm using a regular expression to go...
6
by: Dave | last post by:
I'm struggling with something that should be fairly simple. I just don't know the regext syntax very well, unfortunately. I'd like to parse words out of what is basically a boolean search...
4
by: sasifiqbal | last post by:
Hi All, I have following text Template that needs to be parsed using Regular Expression -- Test Template This is a Test Template for <#OrderNumber/> Sender Message is <#SENDERMESSAGE/>
6
by: dotnetprogram | last post by:
Does anybody have a regular expression to be used in the validation controls of asp.net that checks if the text inputted is: 1) alphanumeric and doesn't include special characters and symbols...
17
by: Mark | last post by:
I must create a routine that finds tokens in small, arbitrary VB code snippets. For example, it might have to find all occurrences of {Formula} I was thinking that using regular expressions...
4
by: MooMaster | last post by:
I'm trying to develop a little script that does some string manipulation. I have some few hundred strings that currently look like this: cond(a,b,c) and I want them to look like this: ...
23
by: codefire | last post by:
Hi, I am trying to get a regexp to validate email addresses but can't get it quite right. The problem is I can't quite find the regexp to deal with ignoring the case james..kirk@fred.com, which...
0
by: altavim | last post by:
Usually when you make regular expression to extract text you are starting from simple expression. When you got to know target text, you are extending your expression. Subsequently very hard to ready...
1
by: NvrBst | last post by:
I want to use the .replace() method with the regular expression /^ %VAR % =,($|&)/. The following DOESN'T replace the "^default.aspx=,($|&)" regular expression with "":...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.