Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Anthony Candaele 1197 posts 2049 karma points
    Oct 18, 2011 @ 14:24
    Anthony Candaele
    0

    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

  • Rodion Novoselov 694 posts 859 karma points
    Oct 18, 2011 @ 14:32
    Rodion Novoselov
    1

    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

  • Anthony Candaele 1197 posts 2049 karma points
    Oct 18, 2011 @ 14:47
    Anthony Candaele
    0

    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

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Oct 18, 2011 @ 15:41
    Tom Fulton
    4

    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

  • Anthony Candaele 1197 posts 2049 karma points
    Oct 18, 2011 @ 15:44
    Anthony Candaele
    0

    Thanks Tom,

    It works, you rock :)

    greetings,

    Anthony

  • Wessel Spoelder 3 posts 26 karma points
    May 12, 2013 @ 09:50
    Wessel Spoelder
    2

    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})$

Please Sign in or register to post replies

Write your reply to:

Draft