Skip to main content
All CollectionsSet up a campaignForm: an essential module
What is a regex and how can I create it?
What is a regex and how can I create it?
Updated over 3 years ago

Please note that regex are for technical profiles. Do not hesitate to consult your IT team for more information.

In computer science, a regular expression is a string of characters that describes a set of possible strings using precise syntax.

This makes it possible to check the format of the data that is used in Adictiz box in form fields.

This format is described by a regular expression.

Example: #(((https?|ftp)://(w{3}\.)?)(?<!www)(\w+?)*\.([a-z]{2,4}))#

For example, here is a regex for a barcode format: ^[0-9]{13}$

This is the type of content you need to configure in the campaign editor for setting up a regex.

Here is a website that will help you to create your own regex : https://regex101.com/

Below are listed few parameters you need to know :

  • The delimiter

First important thing you need to know: a regex (regular expression) is always surrounded by special characters called delimiters. (here: #)

Example: #guitar#

  • The OR

Multiple choices: the 'OR' is symbolized by the vertical bar

Example: #guitar|pipo|flute#

  • Beginning and end of the string

We can also check if the input begins or ends with particular elements:

  • ^ (caret): indicates the beginning of a string;

  • $ (dollar): indicates the end of a string.

Example: #^Hello#

  • Character classes

#p[ioa]t#: This means 'i' OR 'o' OR 'a'. This way, our regex recognizes the words 'pit', 'pot' and 'pat'!

Intervals:

#[a-z]#: contains a letter from a to z

#[A-Z]#: contains a letter from a to z

#[0-9]#: contains a number

#[A-Z0-9]#: contains a letter from A to Z and a number

Inverse indicator (does not contain):

#[^a-z]#: does NOT contain a letter from a to z

#[^A-Z]#: does NOT contain a letter from a to z

#[^0-9]#: does NOT contain a number

#[^A-Z0-9]#: does NOT a letter from A to Z and a number

  • Everything is combinable

Examples:

#^[^a-z]#: does not start with a lowercase letter

#[^aeiouy]$#: does not end with a vowel

#^[^aeiouy]|[^aeiouy]$#: does not begin or end with a vowel

You will find some examples of regex on this page as well as information on the parameters that compose them.

Did this answer your question?