Knowledge Base

Using Regular Expressions in Cartella Survey Questions

Learn how to use regular expressions in survey questions in Cartella. Users can add response restrictions to Cartella survey questions by implementing regular expressions.


Description

Users can add response restrictions to Cartella survey questions by implementing regular expressions.

Reasons to use regular expressions include:

  • Limit Characters. Survey participants may enter extensive responses to open-ended questions. If survey creators prefer shorter responses, they can apply a regular expression to limit the number of characters that participants enter.
  • Set Number Length. Survey creators can specify a number length for survey participants to enter. For example, a regular expression that limits number length may benefit questions about age, zip codes, etc.
  • Prohibit Special Characters. Survey creators can apply a regular expression to prevent participants from entering special characters.

Requirements

Users require at least one of the following:

  • Users must have moderator+ permissions for the module to complete this task.
  • If editing an existing survey, users must have contributor+ permissions for the module and must be the item creator to complete this task.
  • If creating a survey, users must have contributor+ permissions for this module to complete the task.

Step-by-Step

To add a regular expression to a survey question:

  1. Navigate to a Survey module.
  2. Click Create Survey or edit an existing survey.

    Create Survey

  3. Scroll to the Survey Steps area, and click Add to create a survey step.

    Add Survey Step

  4. Select the survey step in the Steps field.
  5. Click Add Question.
  6. Enter an expression in the Regular Expression field.

    Choose an expression that suits your survey needs.

    Regular expression examples include:

    • ^.{1,200}$

      Use this expression to only accept responses that contain 1-200 characters (spaces included).

    • ^\d{3}$

      Use this expression to only accept responses that contain a three-digit number.

    • ^[^!@#$%^&*()_]+$

      Use this expression to only accept responses that don’t contain special characters.

    Regular Expression and RegEx Message Fields

  7. Optional: If applicable, enter a RegEx Message that displays to participants when the survey doesn’t validate a response entry.

    The message clarifies why the survey refused the entry.

Additional Information

  • PRODUCT: Cartella
  • Published: April 12, 2021
  • LAST UPDATED: September 19, 2023
  • Comments: 0

Please login to comment

Comments


There are no comments yet.