Skip to main content

RegexPro

An input field that is validated based on the specified regex pattern (e.g. /^[a-zA-Z0-9]*$/). The field.type property value is regex (for conditionals).

​Settings

  • Specify a required pattern for values to match, e.g. /^[a-zA-Z0-9]*$/.
    • When needing to use {} for attributes in Regex fields (such as pattern), you will need to specify them differently, as Freeform is built to allow Twig rendering and it'll choke. So for example, if you need to use [0-9]{4,5}, change it to:
      [0-9]{{ '{' }}4,5{{ '}' }}
  • Set the error message a user will see if an incorrect value is supplied.
    • Any occurrences of {pattern} will be replaced with specified regex pattern inside the error message, if any are found.

​Templating

PropertyDescription
field.patternThe translated regular expression used to validate the value.
field.messageThe translated validation error message.

​Resources