i am doing jquery form validation, then i searched online for some answers like validating email, but strangely none of the regex is working, basically i put my code below in the dom ready
function validate_email(emailAddress) {
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
};
if (validate_email('gg') {
alert('papa')
) else {
alert('mama');
}
it is not working on my firefox and ie, please help, if you spotted a problem, thanks
While editing your code for formatting, I noticed a missing bracket on this line:
And an incorrect brace on this one:
Since you mentioned firefox, if you haven’t got it already, go download firebug. This error could have been easily spotted by checking for errors in the firebug console.