regular expression for valid email is case-sensitive
Hi,
I discovered that the regular expression for the email-field in the contact form template is case-sensitive
email formats like this [email protected] are considered invalid while the same email address but spelled without capitols is considered valid: [email protected]
I tried to solve this by configuring another regular expression : [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
But the result is the same, email addresses that are a mixture of small and capitol letters are considered invalid.
Hi. Probably the "(?i...)" construct would help. Just embrace your whole expression with round brackets "()" and append "?i" right after the first one.
regular expression for valid email is case-sensitive
Hi,
I discovered that the regular expression for the email-field in the contact form template is case-sensitive
email formats like this [email protected] are considered invalid while the same email address but spelled without capitols is considered valid: [email protected]
I tried to solve this by configuring another regular expression : [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
But the result is the same, email addresses that are a mixture of small and capitol letters are considered invalid.
How can I solve this?
Thanks for your help,
Anthony Candaele
Belgium
Hi. Probably the "(?i...)" construct would help. Just embrace your whole expression with round brackets "()" and append "?i" right after the first one.
http://msdn.microsoft.com/en-us/library/yd1hzczs.aspx#Case
Hi Rodion,
I tried to add this to regular expression setting of the email field, but it doesn't work. All fields under the email field are not rendered anymore.
thanks for your help,
Anthony
Here's one I've used in the past that works for upper/lowercase: ^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,4})$
-Tom
Thanks Tom,
It works, you rock :)
greetings,
Anthony
Thanks Tom, Was looking for that as well.
I changed the part to check the top-level-domain however, to let the (relatively new) .museum top level domain pass.
^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*(\.[a-zA-Z]{2,6})$
is working on a reply...