473,487 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

REgular expression validation

I am using a RegularExpressionValidator to validate against a range on
specific values and it is behaving strangely. My validation expression is as
follows

^001|100|101|101D|102|103|103D|110|110D|111|112|11 3|114|114D|115|115D|116|117|117D|118|118D|119|120| 120D|121|124|126|126D|127|127D|128|128D|129|129D|1 30|130D|131|131D|132|132D|600|610|611|612|613|613D |616|661|711|712|712D|118D$

Which are a series of valid product codes. It validates correctly against
all of the codes that are just numbers, but it does not validate against the
codes that contain a D at the end.

e.g.

It is happy with 001, 100 or 101 but it says 104 is invalid, which is as it
should be. Byt when i enter 110D then it says it is not valid even though it
is in the validation expresion.
Apr 7 '06 #1
1 1170
Regular Expressions consume the strings they match, character by character.
Since you put "110" before "110D", "110" will always be consumed as a match
before the opportunity to find the "D" occurs. To fix, this, simply reverse
the order of items which contain other items. For example:

110|110D should be 110D|110
118|118D should be 118D|118

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Show me your certification without works,
and I'll show my certification
*by* my works.

"clickon" <cl*****@discussions.microsoft.com> wrote in message
news:9B**********************************@microsof t.com...
I am using a RegularExpressionValidator to validate against a range on
specific values and it is behaving strangely. My validation expression is
as
follows

^001|100|101|101D|102|103|103D|110|110D|111|112|11 3|114|114D|115|115D|116|117|117D|118|118D|119|120| 120D|121|124|126|126D|127|127D|128|128D|129|129D|1 30|130D|131|131D|132|132D|600|610|611|612|613|613D |616|661|711|712|712D|118D$

Which are a series of valid product codes. It validates correctly against
all of the codes that are just numbers, but it does not validate against
the
codes that contain a D at the end.

e.g.

It is happy with 001, 100 or 101 but it says 104 is invalid, which is as
it
should be. Byt when i enter 110D then it says it is not valid even though
it
is in the validation expresion.

Apr 7 '06 #2

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

Similar topics

2
18051
by: Bryce Budd | last post by:
Hi all, I am trying to use a regular expression validator to check for the existence of PO Box in an address textbox. The business rule is "No addresses with PO Boxes are allowed." What I...
9
2176
by: Stirling | last post by:
Hi all, hope someone can help me, I am looking to do a password validation check using client side validation. Minimum requirement is that it must contain at least one number and one letter. ...
3
2203
by: Mark | last post by:
To validate the length of a multiline textbox, I'm told that I have to use a regular expression validator. The regular expression below limits it to 25 characters in length, but if the user enters...
2
9842
by: Dot net work | last post by:
Hello. Say I have a .net textbox that uses a .net regularexpressionvalidator. If the regular expression fails, is it possible to launch a small client side javascript function to do something,...
3
7620
by: Robert Scheer | last post by:
Hi. I have a regularexpression validator control on a page. This regular expression validates a textbox to accept only numbers and commas: validationexpression="*" I am trying to modify this...
1
323
by: spalding | last post by:
One issue I've had is successfully searching for regular expression documentation outlining the approach to inverting the test (ie. returning true in the case that the expression is not found)....
18
3012
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
5
3085
by: Ryan | last post by:
HELLO I am using the following MICROSOFT SUGGESTED (somewhere on msdn) regular expression to validate email addresses however I understand that the RFP allows for "+" symbols in the email address...
18
622
by: Lit | last post by:
Hi, I am looking for a Regular expression for a password for my RegExp ValidationControl Requirements are, At least 8 characters long. At least one digit At least one upper case character
2
1810
by: Joey | last post by:
Hello guys, I'm trying to learn about regular expressions. I need to be able to use an RE that can evaluate for STRINGS (or specific sequences of characters), not just occurances of characters....
0
7106
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
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
7181
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...
0
7349
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5442
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4565
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
267
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.