After lots of trial and error I finally got this email validation up on wordpress http://info.cfgt.com.au/diploma-of-management/sq1 but the regex seems to only "half" work.
Basically it will allow anything@anthing and doesn't need the ".domain" at the end.
I've tried other regex strings but Wordpress seems to ignore any regex over about 30 characters, and the shorter ones aren't giving the goods.
<script>
jQuery(document).ready(function() {
jQuery('form').submit(function() {
email_address = jQuery('#inf_field_Email');
email_regex = /^[a-z0-9\._]*[a-z0-9_]@[a-z0-9][a-z0-9\-\.]*[a-z0-9]\.[a-z]{2,6}$/i;
if(!email_regex.test(email_address.val())){
alert('Please enter a valid email');
return false;
}else{
alert('All Good!');
return true;
}
});
});
</script>
Any ideas?
Cheers,
John Detlefs