Copied to clipboard

Flag this post as spam?

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


  • Steve Wilkinson 132 posts 211 karma points
    Apr 07, 2015 @ 09:54
    Steve Wilkinson
    0

    Email address regex rejects any upper case values

    ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$
    

    the above rejects any upper case characters in the email address but mobile devices have a tendency to automatically start a new sentence with a capital and this then gets rejected.

    I didn't think case mattered in emails so shouldn't it let any capitalisation through?

    I tried changing this to

     ^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z]{2,4})$
    

    but this didn't work either.

    Is there anything I can do as we had two customers complain about the same problem?

    Thanks

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Apr 07, 2015 @ 10:09
    Jan Skovgaard
    1

    Hi Steve

    Yeah the capitalization in e-mail should not really matter - Where is the above Regex expressions from? Are they something that you are using on forms fields yourself? Or is it something from Contour/Forms?

    I think you might be able to benefit from this service in order to test whether your regex is working or not https://regex101.com/

    /Jan

  • Steve Wilkinson 132 posts 211 karma points
    Apr 07, 2015 @ 12:57
    Steve Wilkinson
    0

    It's something from the Contour forms standard install - it's in templates/Contact form.ucf

  • Steve Wilkinson 132 posts 211 karma points
    Apr 07, 2015 @ 13:02
    Steve Wilkinson
    0

    Saying that, just noticed that it seems to be a caching thing as the form has changed on the editing url but not the www url even though they point to the same files

  • Chris Wilson 100 posts 377 karma points
    Apr 09, 2015 @ 10:48
    Chris Wilson
    1

    This is the regex I use, it should match all RFC 5322 compliant email addresses:

    [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?
    
Please Sign in or register to post replies

Write your reply to:

Draft