דלגו לתוכן
FillFaster

How to Use Custom Validation

תוכן זה אינו זמין עדיין בשפה שלך.

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

The custom validation regex input field in the form builder

This is how the custom validation input looks for the end user: An example of a custom validation error message shown to the user

  1. Letters only: ^[A-Za-z]+$

    • Matches any string containing only letters (A-Z or a-z).
  2. Numbers only: ^\\d+$

    • Matches any string containing only digits.
  3. Letters and numbers: ^[A-Za-z0-9]+$

    • Matches any string containing letters and/or numbers.
  4. Email address: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$

    • Matches most common email address formats.
  5. Phone number: ^\\+?[\\d\\s-]{7,}$

    • Matches phone numbers with an optional + at the start, and allows digits, spaces, and hyphens.
  6. UK Postcode: ^[a-zA-Z]{1,2}\\d[a-zA-Z\\d]?\\s*\\d[a-zA-Z]{2}$

  • {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
  1. 3-10 letters: ^[A-Za-z]{3,10}$

    • Matches strings with 3 to 10 letters.
  2. US Zip Code: ^\\d{5}(-\\d{4})?$

    • Matches 5-digit zip codes and optional 4-digit extensions.
  3. Date (YYYY-MM-DD): ^\\d{4}-\\d{2}-\\d{2}$

    • Matches dates in the format YYYY-MM-DD.

For more advanced patterns and detailed explanations, visit RegExr.