473,399 Members | 3,832 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,399 software developers and data experts.

REGULAR EXPRESSIONS - identify specific entries as INVALID

Hey all,

I'm looking for some help on coding a validationexpression of regular
expression validation control in C#.

The problem is simple..and it would seem the solution likely is as well.
But I haven't come up with it.

I'd like to validatie a textbox entry.

The entry must be 6 digits. And must NOT equal any of the following four
values : 110500, 101100, 109900, 101007.

I've tried a number of things to no avail. So I won't limit any of your
collective potential solutions with the novice suggestions I've tried.

Thanks in advance!!
Jun 27 '08 #1
5 1024
We don't do drivers in C#. Only Singularity does and it is just a Microsoft
research project released on SourceForge.

P.S. Do your own homework.

"Skinnerfritz" <Sk**********@discussions.microsoft.comwrote in message
news:8E**********************************@microsof t.com...
Hey all,

I'm looking for some help on coding a validationexpression of regular
expression validation control in C#.

The problem is simple..and it would seem the solution likely is as well.
But I haven't come up with it.

I'd like to validatie a textbox entry.

The entry must be 6 digits. And must NOT equal any of the following four
values : 110500, 101100, 109900, 101007.

I've tried a number of things to no avail. So I won't limit any of your
collective potential solutions with the novice suggestions I've tried.

Thanks in advance!!


Jun 27 '08 #2

With all due respect the drivers that you mention are irrelevant to the
Validationexpression property of the regular expression validation control.

The formats I've been looking at are things such as:
/d6 (?!110500|101100)
(?>110500|101100)
(?!(110500$))
etc..

The question is syntactical in nature.

Though I do apologize for posting it in the device.drivers forum.


"David Craig" wrote:
We don't do drivers in C#. Only Singularity does and it is just a Microsoft
research project released on SourceForge.

P.S. Do your own homework.

"Skinnerfritz" <Sk**********@discussions.microsoft.comwrote in message
news:8E**********************************@microsof t.com...
Hey all,

I'm looking for some help on coding a validationexpression of regular
expression validation control in C#.

The problem is simple..and it would seem the solution likely is as well.
But I haven't come up with it.

I'd like to validatie a textbox entry.

The entry must be 6 digits. And must NOT equal any of the following four
values : 110500, 101100, 109900, 101007.

I've tried a number of things to no avail. So I won't limit any of your
collective potential solutions with the novice suggestions I've tried.

Thanks in advance!!


Jun 27 '08 #3
Skinnerfritz wrote:
Hey all,

I'm looking for some help on coding a validationexpression of regular
expression validation control in C#.

The problem is simple..and it would seem the solution likely is as well.
But I haven't come up with it.

I'd like to validatie a textbox entry.

The entry must be 6 digits. And must NOT equal any of the following four
values : 110500, 101100, 109900, 101007.

I've tried a number of things to no avail. So I won't limit any of your
collective potential solutions with the novice suggestions I've tried.

Thanks in advance!!

Use a negative look-ahead:

(?!110500)(?!101100)(?!109900)(?!101007)\d{6}

--
Göran Andersson
_____
http://www.guffa.com
Jun 27 '08 #4
Works perfectly.

Thanks so much, Goran.
"Göran Andersson" wrote:
Skinnerfritz wrote:
Hey all,

I'm looking for some help on coding a validationexpression of regular
expression validation control in C#.

The problem is simple..and it would seem the solution likely is as well.
But I haven't come up with it.

I'd like to validatie a textbox entry.

The entry must be 6 digits. And must NOT equal any of the following four
values : 110500, 101100, 109900, 101007.

I've tried a number of things to no avail. So I won't limit any of your
collective potential solutions with the novice suggestions I've tried.

Thanks in advance!!

Use a negative look-ahead:

(?!110500)(?!101100)(?!109900)(?!101007)\d{6}

--
Göran Andersson
_____
http://www.guffa.com
Jun 27 '08 #5
On Jun 20, 10:07 am, Skinnerfritz
<Skinnerfr...@discussions.microsoft.comwrote:
I'd like to validatie a textbox entry.

The entry must be 6 digits. And must NOT equal any of the following four
values : 110500, 101100, 109900, 101007.
Why would you use a regular expression for this?

Set<intinvalidSet = new Set<int>();
invalidSet.Add(110500);
invalidSet.Add(101100);
invalidSet.Add(109900);
invalidSet.Add(101007);

int val = Convert.ToInt32(textBox.Text);
if (!invalidSet.Contains(val))
{
// ....
}
Jun 27 '08 #6

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

Similar topics

1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
3
by: Joe | last post by:
Hi, I have been using a regular expression that I don’t uite understand to filter the valid email address. My regular expression is as follows: <asp:RegularExpressionValidator...
4
by: Együd Csaba | last post by:
Hi All, I'd like to "compress" the following two filter expressions into one - assuming that it makes sense regarding query execution performance. .... where (adate LIKE "2004.01.10 __:30" or...
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
2
by: PJC | last post by:
Not sure if you can help but I'm having a little trouble with c# and some regular expressions. This is the example I am trying to use: Regex r = new...
6
by: Ludwig | last post by:
Hi, i'm using the regular expression \b\w to find the beginning of a word, in my C# application. If the word is 'public', for example, it works. However, if the word is '<public', it does not...
3
by: LordHog | last post by:
Hello all, I am attempting to create a small scripting application to be used during testing. I extract the commands from the script file I was going to tokenize the each line as one of the...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
0
by: peridian | last post by:
Hi, I wanted a web page where I could post code to, and have it appear in coloured formatting based on the context of the code. Most of the techniques I have seen for this involve complex use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
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,...

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.