I'm trying to write a simple RegExp that would validate a login name:
function _validateLogin( login ) {
//This should allow for [a-zA-Z0-9_] as well as '.' and '@'
//Spaces are not allowed
var re = /[\w\.@]+/;
return re.test( login );
}
But for some reason it returns true even if I give it 'aa aa'.
What am i doing wrong?