Enforcing Input Formats with Regular Expressions

You can use regex (Regular Expressions) in your Polling.com questions to control the format of responses. By adding a regex pattern in the Pattern Validation field, you ensure that responders submit their answers in the format you specify.

If you're new to Regular Expressions or want to explore further, we recommend visiting these helpful resources:

To Set Up Regex Pattern Validation in Polling.com, follow these steps:

  1. Create your survey question. Regex1a.fw

  2. Click "Settings" on the question where you want to apply regex validation. Regex1b.fw

  3. Enter a placeholder.

💡 This gives your respondents a hint about the expected format (e.g., 123-456-7890).

Regex1c.fw

  1. Enter your regex pattern in the Pattern Validation field.

Example: \d{3}-\d{3}-\d{4} enforces a phone number format like the placeholder.

Regex1d.fw

📌 Basic Building Blocks of Regex:

Symbol What it means Example What it matches
`.` Any character (except newline) `a.c` Matches "abc", "a1c", "a-c"
`*` Zero or more of the previous thing `ba*` "b", "ba", "baa", "baaa"
`+` One or more of the previous thing `ba+` "ba", "baa", "baaa" (not "b")
`?` Optional (zero or one) `ba?` "b", "ba"(not "b")
`[]` Match any character inside `[abc]` "a", "b", or "c"
`[^]` NOT these characters `[^a]` Any character except "a"
`\d` Any digit (0–9) `\d\d` "23", "99"
`\w` Word character (a–z, A–Z, 0–9, \_) `\w+` "hello", "test123"
`\s` Whitespace (space, tab, newline) `\s+` One or more spaces/tabs
`^` Start of a line `^Hi` "Hi there" at the beginning of a line
`$` End of a line `bye$` "Say bye" if "bye" is at the end
  1. Click "Save & Close".
  2. Once enabled, Pattern Validation will require that responses match the format you set. If not, users will see a prompt notifying them of the invalid format when submitting.

Regex1e.fw