Short version:
How can I get a regex that matches [email protected] but not [email protected] using CAtlRegExp ?
Long version:
I'm using CAtlRegExp http://msdn.microsoft.com/en-us/library/k3zs4axe(VS.80).aspx to try to match email addresses. I want to use the regex
^[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}$
extracted from here. But the syntax that CAtlRegExp accepts is different than the one used there. This regex returns the error REPARSE_ERROR_BRACKET_EXPECTED, you can check for yourself using this app: http://www.codeproject.com/KB/string/mfcregex.aspx
Using said app, I created this regex:
^[a-zA-Z0-9\._%\+\-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z]$
But the problem is this matches [email protected] as valid, I need it to match 4 characters maximum for the op-level domain.
So, how can I get a regex that matches [email protected] but not [email protected] ?