I am fairly new to Wix and have no coding experience. I need to apply certain validations to my e-mail field in a form.
I am successfully able to validate other fields using Regex but when I apply on e-mail field the below Regex it doesn’t seem to be working and instead it rejects all values in e-mail field as invalid.
function validateEmail(email) { var re = /^(([^<>()\.,;:\s@“]+(.[^<>()\.,;:\s@”]+)*)|(“.+”))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/; return re.test(email.toLowerCase()); }
Is that the one you are using?
See more here:
Validating emails is a very common problem → (google is your friend)
i know this is an old topic but can someone please provide a REGEX for the below criteria? the non-code one please. i would like to inset it in the settings of the input.
At least 8 characters
At least 1 capital letter
At least 1 lowercase letter
At least 1 number
At least 1 special character
also if possible i would like the users to be able to use all special characters
=±_)(*&^%$#@!~`/|}{][":';?><., besides being alphanumeric
As for the original post, there was a space after @ which causes an error since emails don’t have spaces. Additionally, it was written to only be uppercase, whereas most emails are either lowercase. This should work well for most real-world emails: ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$