RegularExpressionAttribute - How to make it not case sensitive for client side validation?

I have a string that I use for client side validation:

private const String regex = @"^(?:\b(?:\d{5}(?:\s*-\s*\d{5})?|([A-Z]{2})\d{3}(?:\s*-\s*\1\d{3})?)(?:,\s*)?)+$";

I use this string in my [RegularExpression(regex, ErrorMessage = "invalid")] attribute.

I know that the /i flag for a Javascript regex is used to make it case insensitive, but just tacking it on to the end of my regex (i.e. @"^....$/i" isn't working - the regex validation fails completely, regardless of what is entered (valid or not).

What am I missing?

21
задан Scott Baker 18 November 2010 в 09:43
поделиться

0 ответов

Другие вопросы по тегам:

Похожие вопросы: