I want to check email address with Regex in C #.
I am using this template:
^[A-Z0-9._%-] +@ [A-Z0-9.-]+\.[AZ]{2,4}$
This pattern matches only lowercase letters. For instance:
" example@gmail.com " β returns false. " EXAMPLE@GMAIL.COM " β returns true.
I obviously would like the first example to return true as well.
NOTE. I DO NOT want to use the RegexOptions.IgnoreCase flag.
I would like to modify the template itself to fit the first example. I think I can add "/ i" at the end of the pattern or something like this, but it does not seem to work. I prefer not to use "? I" at the beginning.
How can i achieve this?
(If you could rewrite the entire template for me, that would be great!).
Thanks.
source share