What are regular expressions?

A regular expression (regex or regexp for short) is a special text string for describing a search pattern.It is unlimited what a regular expression can include and/or exclude. Here we will be listing the most popular user-requested examples:


Wildcard examples: (where * can be anything)
1: www.example.com/pages/*
Text: ^(http|https):\/\/example.com\/pages\/.*$

2: www.example.com/pages/*/article/
Text: ^(http|https):\/\/example.com\/pages\/[^\/]+\/article\/$

3: www.example.com/user//profile/ (numeric user_id)
Text: ^(http|https):\/\/example.com\/user\/[0-9]+\/profile\/$



Wildcard excluding a certain pattern:
Target all pages which match the pattern but no not include the word “article” or “post”:
www.example.com/pages/*/subpage/
Text: ^(http|https):\/\/example.com\/pages\/(?!article|post)[^\/]+\/subpage\/$



Excluding certain words or patterns in a URL:
1: Target all pages which do not include “/somepage” and “/someotherpage”
Text: ^((?!\/somepage|\/someotherpage).)*$
2: Target pages which include the word “page” and do not include “somepage”
Text: (?=.*page.*)(?!.*otherpage).*
Multiple pages which don’t follow any pattern:
Text: ^(http|https):\/\/example.com\/pages\/(article-one|some-random-word|another-post)\/details\/$

NOTE:

    While creating campaings with Regular Expression in any tool please do not include www (www.example.com) in rigix, only use URL without www (example.com). Because the TruConversion only consider the URL starting from domain part in regular expression.