Alphanumeric, dash and underscore but no spaces regular expression check Javascript
var regexp = /^[a-zA-Z0-9-_]+$/;
var check = "checkme";
if (check.search(regexp) == -1)
{ alert('invalid'); }
else
{ alert('valid'); }
Only Alphanumeric regular expression check Javascript
var regexp = /^[a-zA-Z0-9]+$/;
var check = "checkme";
if (check.search(regexp) == -1)
{ alert('invalid'); }
else
{ alert('valid'); }
0 comments:
Post a Comment