• A new version of Full Calendar is now available.

    See the details here

Regular Expression validation

  • Views Views: 16,749
  • Last updated Last updated:

Navigation

      Access element (+)
      Birthday element
      Button element
      Calculation element
      Captcha element
      Checkbox element
      Colour Picker element
      Count element (+)
      Database join element
      Date element
      Digg element
      Display text element
      Dropdown element
      Facebook Like element
      Field element
      File Upload element
      Folder element
      Google Map element
      Image element
         Image databese join
      Internal id element
      IP element
      J!Date element
      Kaltura element
      Link element
      Notes element
      OpenStreetMap element
      Picklist element
      Radio Button element
      Rating element
      Sequence element
      Slider element
      Tags element
      Textarea element
      Thumbs element
      Time element
      Timer element
      Timestamp element
      Total element
      User element
      User group element
      Video element
      View level element
      YesNo element
      Youtube element
      Akismet validation
      Is Email validation
      Is Not validation
      Is Numeric validation
      Not empty validation
      PHP validation
      Rsa id
  • A customizable Validation rule. Runs a Regular Expression to test for Validation success or failure

    validation-regex.png

    • 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:

    http://ch.php.net/manual/en/reference.pcre.pattern.syntax.php

    http://www.regular-expressions.info/quickstart.html

    Library of user submitted regular expressions

    Example Regular Expressions​

    US Phone number​
    Code:

    /^[0-9]{3}-[0-9]{3}-[0-9]{4}|[0-9]{10}|[(][0-9]{3}[)][0-9]{3}-[0-9]{4}$/

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

    US Social Security number​

    Code:

    /\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​
    Code:

    /(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​
    Code:
    /^\w*$/
Back
Top