I have following regular expression for postal code of Canada.
^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$
It is working fine but accepts only Capital letters. I want it work for both capital and small letters.
Home / DeveloperSection / Forums / How to make a regex match case insensitive?
I have following regular expression for postal code of Canada.
^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$
It is working fine but accepts only Capital letters. I want it work for both capital and small letters.
Pravesh Singh
03-Feb-2014Just use the option IgnoreCase,
So your regex creation could look like this
I removed also all your {1} because it is superfluous. Every item is per default matched once, no need to state this explicitly.