Skip to main content

Hello 👋

In May 2024, Unbounce launched the ability to use Regex Code to Verify Form Fields. A great addition; however, I noticed a potentially unintended result with regard to email verification.

The Problem:

To use Regex, you need to turn off ‘email verification’ and Regex alone doesn’t appear to handle both.

In the Unbounce Article 🔗Setting Up Form Field Validation with Regular Expressions it gives the following code as an example to verify email address domains:
^(?!.*@(gmail\.com|yahoo\.com| hotmail\.com)).*$

To use this code, first you need to disable ‘verify as email address’ to allow Regex.

Entering the code above will indeed disallow @gmail addresses but is also doesn’t verify an email is input. The result is that “testgmail.com” and “test@gmailcom” in non-email formats are able to be submitted.

Troubleshooting:

I’m not well versed in writing Regex Code so I tried using GPT4.5 without a solution. Went back and forth for the better part of an hour with various attempts and no luck. In the end, I was curious if it was something about how Unbounce potentially implemented Regex for that field that is limiting the solution? Thus this post was born.

Solution:
I don’t have a current solution, so I’m curious if anyone in the community has come across a fix for this or came across the same issue?

Additionally, Regex code that should work and is validated in a Regex Validator does not work
^(?!.*@(gmail|yahoo|hotmail).com$)$a-zA-Z0-9._%+-]+@+a-zA-Z0-9.-]+.+a-zA-Z]{2,}$

This code still allows all submissions to pass for some reason within Unbounce.


Hey @colinsa

Try this regex: 

^(?!?^@\s]+@(gmail|yahoo|hotmail)\.com$)$^@\s]+@+^@\s]+\.\a-zA-Z]{2,}$

 


Hey @colinsa,

I haven’t tried this yet, so let me know if @Hristian’s reply worked for you. If so, great! If not, then I’ll research it as well and see if we can fix that.

Thanks,


@Hristian Looks like this worked, thank you 🙌


Reply