Regular Expressions


Prerequisites: Users require at least one of the following:

  • Users require moderator+ permissions for the module to complete this task.
  • If editing an existing survey,Users require contributor+ permissions for the module and must be the item creator to complete this task.
  • If creating a survey, Users require contributor+ permissions for this module to complete the task.
Regular expressions is a programming syntax that can process, match, and validate patterns of characters in text strings. Meta-characters (for example, $, which refers to the end of a string, or “.”, which refers to any character) make regular expressions powerful and efficient—they can describe complex patterns using relatively few characters.

By using regular expressions in Cartella’s survey module, customize and add flexibility to surveys. Use regular expressions to ensure that users select a certain answer; to limit a text answer to certain number of characters; or to ensure that a valid email address was entered.

Important
A full tutorial on regular expressions is beyond the scope of this guide. Ingeniux recommends that you only allow trusted employees to create surveys, because regular expressions can be used in denial of service attacks. For information about writing regular expressions in .NET framework, see .NET Regular Expressions.

The Regular Expression and RegEx Message fields display for each survey question.

Enter the code for the regular expression in the Regular Expression field, and in the RegEx Message field, enter a message to display if the user’s answer doesn’t match the regular expression. In the example below, the regular expression requires that a text answer be between one and 50 characters.

Warning
If a user enters a value with zero characters and attempts to progress to the next step of the survey, the user sees an error message via the RegEx Message field.