Use Regex to validate lead form entries

Using a lead capture form before you show the results to a quiz, personality test or poll is a great way to get leads and grow your email list.

However, sometimes you need data from your users – and you want to make sure the data is in the right format for processing:

  • Ensure a phone number is in the right format
  • Make sure a street address contains a number
  • Make sure an entry has a minimum number of characters
  • For certain special characters
  • Match elements of a URL (if you only want to limit entries to people with .edu domains, for example)

For all these purposes, here comes a super powerful new form field in the Riddle quiz maker lead generation form builder: REGEX fields (short for Regular Expressions)

We should tell you upfront – REGEX is powerful, but more than a little complex. Don’t fret – we’re to help out! 

Are you a REGEX expressions wizard?

Just stop reading right here and log in to Riddle’s quiz maker – then add the new form field to your lead forms.

regex expressions

REGEX expressions rookie? Read on…

Right, for everyone else, get a cup of coffee and read on.

With REGEX you can make sure that the data entered into a form field follows a very specific formatting rule.

  • For example, imagine your database requires all phone numbers to be in the format (area code)-3digits-4digits like (402)-123-3434:
  • You can use REGEX to accept any slight variation of that – such as 1 (402).123.3434.
  • Define the required format – your readers won’t be able to submit the form until their phone number matches that format.
  • All the data in your database will be nice and consistent. 

The regular expression you need to enter to achieve that result is:


Sure – not very intuitive, but once you get the hang of REGEX, you can do one heck of a lot.

Now, none of us here at Riddle have all these regular expressions memorized – but there are some really good websites to help you with this.

My current favorite:

  • They have a great list of top regular expressions such as “Match dates”, “URL”, “Check if a string contains a number”.
  • Plus they include both a cheat sheet and a tool so you can test your expressions before you add them to your Riddle quiz.

For a longer introduction, we recommend this Medium Post to read if you are brand new to Regex.

And of course, you can always ask us at via support chat or – as customer service geeks, we’re super fast at responding.