Postal code

Below is a validation for postal codes. For additional validation, please see Using regular expressions from the LimeSurvey Manual.

The following validation:

  • Works for Canadian postal codes. For postal codes in other countries, please see the postcodes section from the LimeSurvey manual.
  • Is case insensitive
  • Works for the following formats:
    • A1B2C3 (no space)
    • a1B 2C3 (space)
    • a1b-2c3 (dash)

Steps to add postal code validation:

Ensure the Question Type is Short free text.

  1. Add a new question or edit an existing question
  2. Under General options (right-hand side):
    1. Make sure Question type is Short free text
    2. Copy and paste the validation expression (below) into the Validation field 

Validation expression: /^[a-zA-Z]\d{1}[a-zA-Z](\-| |)\d{1}[a-zA-Z]\d{1}$/

postal code valid.jpg

Add comment

You can add a comment by filling out the form below. Plain text formatting. Web and email addresses are transformed into clickable links. Comments are moderated.