Great little snippet of code for validating an email address and a phone number using ActionScript. I love this little functions you can drop in code and just run with. A link to the post here. I have linked rather than replicate the code as I believe in crediting the original author.
Pages
RSS Feed
-
Blog Stats
- 102,167 hits
My Twitter
- Now it's time to celebrate by having dinner :). L8rs 2 hours ago
- Someone call the papers! Actually able to have some windows open today to let the less than hot air blow through...must be Christmas! 2 hours ago
- And more reliable driver updates than my Epson R1800 on Snow Leopard...POS Epson support 2 hours ago
- Next up will be the HP scanner/printer. Brought a HP c309g printer, impressive quality 2 hours ago
- Spent today setting up my Win 7 VM with Vstudio and BitDefender in @Parallels still impressed with speed! 2 hours ago
3 Comments
Link to post does not work. Any way to post this little snippet?
Yeah appears to be down, I’ll post the code here that I found in a cache, if the original poster is unhappy about it just let me know and I’ll remove it. Probably just a temporary server problem their end or something like that.
Email Validation:
function validateEmail(email:String):Boolean {
var emailExpression:RegExp = /^[a-z][w.-]+@w[w.-]+.[w.-]*[a-z][a-z]$/i;
return ! emailExpression.test(email);
}
Phone Validation:
function validatePhone(phone:String):Boolean {
var emailExpression:RegExp = /^((+d{1,3}(-| )’(‘d)’(-| )’d{1,3})|((’d{2,3})’))(-| )’(d{3,4})(-| )’(d{4})(( x| ext)d{1,5}){0,1}$/i;
return ! emailExpression.test(phone);
}
try this:
his;am@hotmail.com
I think the function will return ‘true’.