Regular expressions

Regular expressions are used in Octory to validate a user input in a text field. It is very powerful to let you customize the validation.

You can find the full documentation on the syntax here

Octory and the script (see below) will validate a string only if the first match found by the regular expression equals the overall string.

Special characters

To use the following characters in the regular expression (in command-line or in the configuration file), add an escape slash \ before: * ? + [ ( ) { } ^ $ | \ . /


Useful Examples

Regular expression

[a-zA-Z0-9]{3}-[a-zA-Z0-9]{3}-[a-zA-Z0-9]{3}

Validate a string which can contain only alphanumeric characters in 3 groups of 3 characters separated by hyphens.

The {n} operator allows to repeat n number of times the expression

Possible uses examples

Serial number, asset tag

Example of strings validated by the regular expression


Regular expression

MBP[1-9]{1,3}

Validate a string which begins by "MBP" and is followed by 1 or 3 digits.

The {n, m} operator allows to repeat n number of times the expression

Possible uses examples

When the MacBook Pro in your company are identified with MBP###

Example of strings validated by the regular expression

MBP23, MBP1, MBP458


Regular expression

[A-Z][a-z]*

Validate a string beginning by one capital letter, then any letter in the alphabet.

The * operator allows to repeat 0 or more times the expression.

Possible uses examples

First or last name.

Example of strings validated by the regular expression


Regular expression

(France|Germany).(Campus1|Campus2)

Validate a string which begins by "France" or "Germany" and is separated by a point to "Campus1" or "Campus2"

Possible uses examples

When the MacBook Pro in your company are identified with MBP###

Example of strings validated by the regular expression


Regular expression

\$[0-9]*

Validate a string which begins by a $ sign, followed by digits only.

Possible uses examples

Amount of money

Example of strings validated by the regular expression