Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Regular expression help required

  • 28-03-2007 4:29pm
    #1
    Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭


    This is for an Asp.net (2) regex validator control. Its the default pattern matcher for a valid email address.
    \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
    

    How can I modify this to ignore trailing whitespace in the email address being validated?


Comments

  • Users Awaiting Email Confirmation Posts: 351 ✭✭ron_darrell


    Been a while but I think this will do it:

    \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*[¬\s]

    Hope that helps
    -RD


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    What I ended up doing in the end was \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*\s*

    which ingnores any white space that may be there, including tabs.

    \w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*[¬\s]

    Only seems to work if there is a single nonbreaking space present..


  • Registered Users, Registered Users 2 Posts: 6,571 ✭✭✭daymobrew


    I found a suggestion in the Perl FAQ. It includes a link to a script that does a complete check (including contacting the email server). I'm sure both could be ported to ASP.


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Thanks daymobrew but its just for a form processing. It doesn't have to be an existing email address, just as long as its resembles one.


  • Registered Users, Registered Users 2 Posts: 2,931 ✭✭✭Ginger


    Phil you might want to check out Regulazy its great at working these out for you ... hence the lazy bit in the name

    http://tools.osherove.com/Default.aspx?tabid=182


  • Advertisement
Advertisement