Page 1 of 1

Validate Email address with regular expression?

Posted: Wed Aug 20, 2014 11:50 am
by Michael.Duraj
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?

Re: Validate Email address with regular expression?

Posted: Wed Aug 20, 2014 12:09 pm
by allistar
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).

Re: Validate Email address with regular expression?

Posted: Wed Aug 20, 2014 12:34 pm
by Michael.Duraj
There are plenty of regular expression external libraries that you could hook an external function up to and call from JADE.
Thanks