Regular Expression Examples

Last modified on 2022/08/17 10:39

The regular expression examples provided in the wizard verify that the input string contains the pattern.

You can use these examples in constraints of questionnaires.

Best Practice

  • To make sure the input does not contain other information, add ^ at the begining and $ at the end of the regular expression.

example  Add the characters displayed in yellow below.



Expected format Examples Corresponding regular expression
European phone number, with or without extra information
  • +(33) (office)
  • +(33) (mobile)
One European phone number, without any other information
  • +(33)
One USA phone number, without any other information
  • +(33)
^(\([0-9]{3}\) |[0-9]{3}-)[0-9]{3}-[0-9]{4}$
One email, without any other information
String limited to 15 characters abc123 @ & xyz

Note: It is not advisable to apply this type of constraint on memo questions, where HTML code may be added when the text is formatted. When the constraint is being checked, the whole character string will be considered (the text entered as well as the HTML code).

example   If a user enters A bold text in a memo question, the character string considered is <strong>A bold text</strong> and the size of the string is 28 characters, not 11

Powered by XWiki © EasyVista 2022