A Bogus A Bogus - 4 months ago 30
ASP.NET (C#) Question

C# ASP.NET application Regular expression

For a C#, ASP.NET application -
This should be simple, but I can't figure out this regular expression, I need a list of strings that a text box can not submit as a value, and I have to ignore the case.

Example -
No matter the capitalization, I need my regular expression to reject the following strings -
abc, def, ghi

I can't even get the regex to reject one of them. I tried the following manner -

[RegularExpression(@"(\W|^)(?i)!ABC(?-i)(\W|$)", ErrorMessage = "REJECTED!")]
public string Letters { get; set; }

That does not work! It seems to reject everything. Anyone know what it should look like?
How can I reject all of them?

Thanks for any help can provide!


Quick and dirty, but give this a try (assuming I understand the problem correctly!)