Skip to content
FillFaster

How to Use Custom Validation

Custom validation allows you to define specific rules for input fields using regular expressions (regex).

Note: This option is currently available only for the field types: ‘Text’ and ‘Number’

Basic Regex Patterns

  1. Letters only: ^[A-Za-z]+$
  • Matches any string containing only letters (A-Z or a-z).
  1. Numbers only: ^\d+$
  • Matches any string containing only digits.
  1. Letters and numbers: ^[A-Za-z0-9]+$
  • Matches any string containing letters and/or numbers.
  1. Email address: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$
  • Matches most common email address formats.
  1. Phone number: ^+?[\d\s-]{7,}$
  • Matches phone numbers with optional ‘+’ at the start, and allows digits, spaces, and hyphens.
  1. UK Postcode: ^[a-zA-Z]2\d[a-zA-Z\d]?\s*\d[a-zA-Z]2$

Quantifiers

  • {n}: Exactly n times
  • {n,}: n or more times
  • {n,m}: Between n and m times
  • *: 0 or more times
  • +: 1 or more times
  • ?: 0 or 1 time

Examples

  1. 3-10 letters: ^[A-Za-z]10$
  • Matches strings with 3 to 10 letters.
  1. US Zip Code: ^\d5(-\d4)?$
  • Matches 5-digit zip codes and optional 4-digit extensions.
  1. Date (YYYY-MM-DD): ^\d4-\d2-\d2$
  • Matches dates in the format YYYY-MM-DD.

For more advanced patterns and detailed explanations, visit RegExr.