Validate Email address with regular expression?

Forums for specific tips, techniques and example code
Michael.Duraj
Posts: 30
Joined: Fri Jun 17, 2011 12:55 pm

Validate Email address with regular expression?

Postby Michael.Duraj » Wed Aug 20, 2014 11:50 am

Hi all

I am after a better way to validate email addresses, ideally one that purely deals with a String -> with vars emailaddress : String;
I could then script to weed out erroneous email addresses in our system.

Ideally applying a Regular Expression to String like;

[a-z0-9!#$%&''*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?

Thoughts?

allistar
Posts: 156
Joined: Fri Aug 14, 2009 11:02 am
Location: Mount Maunganui, Tauranga

Re: Validate Email address with regular expression?

Postby allistar » Wed Aug 20, 2014 12:09 pm

There are plenty of regular expression external libraries that you could hook an external function up to and call from JADE. This should give a fairly efficient solution. Otherwise you could rely on a more naive implementation in JADE (e.g. check for an "@", make sure the characters before are valid, make sure characters after are valid etc).

Michael.Duraj
Posts: 30
Joined: Fri Jun 17, 2011 12:55 pm

Re: Validate Email address with regular expression?

Postby Michael.Duraj » Wed Aug 20, 2014 12:34 pm

There are plenty of regular expression external libraries that you could hook an external function up to and call from JADE.
Thanks


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 8 guests

cron