martes, 1 de abril de 2008

Regular Expressions in JavaScript

Ok I'm here in sieena programing but I don't know how to use regular expressions in JavaScript, so this is the first thing that I will learn. Here is the example:

var objRegExp = /(^[a-z0-9]([a-z0-9_\.]*)@([a-z0-9_\.]*)([.][a-z0-9]{3})$)|(^[a-z0-9]([a-z0-9_\.]*)@([a-z0-9_\.]*)(\.[a-z0-9]{3})(\.[a-z0-9]{2})*$)/i;
var valid = objRegExp.test(tag.value);
if( !valid )
alert( "Please provide a valid Email Address." );
return false;

No hay comentarios: