473,395 Members | 1,977 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,395 software developers and data experts.

multiple rejection

Hi everyone,

What I'm trying to do is, to match all the countries in a list, except
US and CANADA which is (CA).

I tried a lot, but none of mine worked at all. I'm new to regular
expressins and I looks completely none sense for me. I need this for
work ASAP.

Thanks everyone.

I was starting with this: [^US]|[^CA]. But as I was told after, that
matches soemthing weird, like Not U or Not S or not C or not A =\
bassically it matches everything =)

I need to match ^US AND ^CA, basically I want to exclude this to
countries.

Thanks a lot,

Alexander

Dec 24 '05 #1
1 1107
KJ
Try these:

string s1 = "CA";
string s2 = "FU";

if (Regex.Match(s1, "(US|CA)").Success)
{
Console.WriteLine("Country code '" + s1 + "' not ok.");
}

if (!Regex.Match(s2, "(US|CA)").Success)
{
Console.WriteLine("Country code '" + s2 + "' ok.");
}

// OR

if (Regex.Match(s1, "(?!(US|CA))").Success)
{
Console.WriteLine("Country code '" + s1 + "' not ok.");
}

if (Regex.Match(s2, "(?!(US|CA))").Success)
{
Console.WriteLine("Country code '" + s2 + "' ok.");
}

Dec 24 '05 #2

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

Similar topics

6
by: Rolf Wester | last post by:
Hi, I have a form with a select element with multiple="true". When using the GET method (I suppose the same happens with the POST method) I can seen that the form sends channels=CH1&channels=CH2...
0
by: Raymond Arthur St. Marie II of III | last post by:
Del's "except"ional PEP Rejection Ladieees and Gentilmen and Pyth-O-neers of all ages. Step right up. Don't be shy. Come one come all. Be the first on your block TO GROK *THE* one *THE* only...
66
by: Darren Dale | last post by:
Hello, def test(data): i = ? This is the line I have trouble with if i==1: return data else: return data a,b,c,d = test()
11
by: Ohaya | last post by:
Hi, I'm trying to understand a situation where ASP seems to be "blocking" of "queuing" requests. This is on a Win2K Advanced Server, with IIS5. I've seen some posts (e.g.,...
6
by: Ben Hallert | last post by:
Hi guys, I'm trying to figure out what bone headed mistake I made on something I put together. I've got a form (named 'context') that has a variable number of select-multiple inputs on it. ...
0
by: misscrf | last post by:
I am currently working on a database, in 3rd normal form, which is for candidates who apply for a job with the law firm that I workd for. My issue is with good form design. I have a main...
22
by: Matthew Louden | last post by:
I want to know why C# doesnt support multiple inheritance? But why we can inherit multiple interfaces instead? I know this is the rule, but I dont understand why. Can anyone give me some concrete...
14
by: Mattia | last post by:
I have a very big problem. I must send a single mail to multiple receivers. The number of receivers are very big: approximately 6000 users, but this number increase each year. I find a lot of...
35
by: keerthyragavendran | last post by:
hi i'm downloading a single file using multiple threads... how can i specify a particular range of bytes alone from a single large file... for example say if i need only bytes ranging from...
0
by: JPabich | last post by:
I am devloping a page that is using a GridView. Within one column of the gridview I would like to place three different types of fields. I need one label, one checkbox and one drop down list. Is...
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: 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...
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
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...
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...

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.