1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

Regular Expression validation

Jan 7, 2016
Regular Expression validation
  • A customizable validation rule. Runs a Regular Expression to test for validation success or failure

    • Error message - The message to display next to the element if the validation fails. This text should explain why the validation failed and what steps the user should take to remedy the error.
    • Condition - A PHP expression which if returns false, means that the validation is not run. See here for more information.
    • Regular expression- A regular expression (must start and end with /)
      • Uses PHP's preg_match function to determine if there is a match in the data. If there is then validation succeeds otherwise it fails
    • Match or Replace
      • If set to match then the validation behaves as normal and on validation failure returns you to the form showing the error message.
      • If set to 'replace' then the submitted value is replaced with the data contained in the field 'Replace string'
    • Replace string - the data to replace the submitted data with if the validation fails and 'Match or Replace' is set to 'Replace'
    • Tip text - The hover text used to describe the validation.
    • Icon - the icon to use for the validation. Appears next to the field label.
    Note that people looking for input masks should use the regular express (or php validation rule)

    Helpful links:



    Library of user submitted regular expressions

    Example Regular Expressions (top)

    US Phone number (top)
    Code (Text):

    Will match the following formats
    • 1231234567
    • 123-123-4567
    • (123)123-4567
    Phone number example:

    US Social Security number (top)

    Code (Text):

    /\b(?!000)(?!666)(?:[0-6]\d{2}|7(?:[0-356]\d|7[012]))[- ](?!00)\d{2}[- ](?!0000)\d{4}\b/
    Will match the valid formats as described here http://en.wikipedia.org/wiki/Social_Security_number#Valid_SSNs

    UK Post code (top)
    Code (Text):

    /(GIR 0AA)|((([A-Z-[QVX]][0-9][0-9]?)|(([A-Z-[QVX]][A-Z-[IJZ]][0-9][0-9]?)|(([A-Z-[QVX]][0-9][A-HJKSTUW])|([A-Z-[QVX]][A-Z-[IJZ]][0-9][ABEHMNPRVWXY])))) [0-9][A-Z-[CIKMOV]]{2}) /
    Alphanumeric without spaces(top)
    Code (Text):
  • Loading...