I want to validate just the beginning of an email address. I will force the user to use my '@company.com' domain, so it is not important to use that. This is the regular expression I'm using:
var validateEmail = /^[A-Z0-9._%+-]$/
And I'm testing it with an alert.
alert(validateEmail.test([$(this).attr('value')]));
The value pulled via jQuery is the user input. Everything I test alerts as false
. Does anyone see why? From what I understand, this should mean: beginning of line, character set for alpha-numeric plus the . _ % + -
symbols, then end of line. What am I doing wrong? Even just an 'a' alerts as false
.