Qu’est-ce que les Regex ?

Last Updated octobre 21, 2026

Brief Overview

Regular expressions, known as regex, allow you to manipulate dynamic text that appears in WalkMe content or that is part of automated processes. Using regex syntax is ideal for situations where dynamic text values you are using contain both the values you want and other characters that aren't relevant.

Learn more about regex. 

Use Cases

Regex use cases include the following:

  • When dynamic text includes a user's first and last name, use regex to select and display only their first name in a ShoutOut or balloon to make it more personal (visual display)
  • Auto-populate your users' email address (when it's part of a larger object with additional data) into a text field upon page load (automation)
  • Select only part of a URL when using dynamic text to automatically take the user to a different page

Example use case

A customer wants to have a SmartTip display when an on screen element showing a date, is before or equal to January 31, 2019.

How to tackle the problem:

  1. Outline possible values you want to match and values you do not want to match
  2. Break the problem down into multiple groups of rules which, when combined, encompass all values you want to match
    1. In this example we have four different patterns we want to match:
      1. Any dates during January 2019
      2. Any date between January 1, 2010 and December 31, 2018
      3. Any date between January 1, 2000 and December 31, 2009
      4. Any date between January 1, 0000 and December 31, 1999
  3. Form the rules to handle each of the above cases and test them:
    1. ^Jan[\s]+[0123]?[\d]+,[\s]+2019$
    2. ^[\w]+[\s]+[0123]?[\d]+,[\s]+201[012345678]$
    3. ^[\w]+[\s]+[0123]?[\d]+,[\s]+200[0123456789]$
    4. ^[\w]+[\s]+[0123]?[\d]+,[\s]+[01][\d]{3}$
  4. After testing each group, combine into one string using the pipe (remove excess ^ and $s)
    • ^Jan[\s]+[0123]?[\d]+,[\s]+2019|[\w]+[\s]+[0123]?[\d]+,[\s]+201[012345678]|[\w]+[\s]+[0123]?[\d]+,[\s]+200[0123456789]|[\w]+[\s]+[0123]?[\d]+,[\s]+[01][\d]{3}$
  5. Implement the above RegEx in the SmartTip's display segment rule using:
    • OSE/jQuery > Text is per Regular Expression > ^Jan[\s]+[0123]?[\d]+,[\s]+2019|[\w]+[\s]+[0123]?[\d]+,[\s]+201[012345678]|[\w]+[\s]+[0123]?[\d]+,[\s]+200[0123456789]|[\w]+[\s]+[0123]?[\d]+,[\s]+[01][\d]{3}$
  6. Result: SmartTip will display when the element's text value is January 1, 0000 all the way to Jan 31, 2019

How It Works

Begin with an opening regex tag containing the regular expression itself, followed by the statement you wish to apply the regular expression to, and end with a closing regex tag:

[regex="{the regex itself}"]{text to perform the regex on}[/regex]

Remarque

  • {texte sur lequel effectuer la regex} peut être un mélange de plusieurs valeurs de texte dynamiques, telles que des variables, des cookies, des données WalkMe et jQuery, ainsi que des valeurs statiques.
  • La plupart, sinon toutes les utilisations de texte dans les expressions rationnelles seront dynamiques, avec une utilisation minimale de valeurs de texte statiques.

Prise en charge de l'utilisation des expressions rationnelles (regex) chez WalkMe

Types de règles du générateur de conditions :

  • Élément sélectionné
  • URL
  • Attributs de l'utilisateur
  • jQuery
  • Élément sur l'écran
  • Variable (données de l'utilisateur)

BBCode pour le contenu WalkMe :

  • Affichage visuel
    • Étape Smart Walk-Thru
    • ShoutOut
    • Directives SmartTip
    • Survey
  • Automatisation
    • Étape automatique Smart Walk-Thru (remplir le texte et sélectionner la valeur de la liste)
    • Étape de redirection Smart Walk-Thru

Regex Structure

Starting and ending demarcators

When outside of brackets, ^ will denote the start of a regex and is used with the $ to denote the end of the regex.

Exemples

  • Regex in an extension package: ^https:\/\/ecolab\.my\.salesforce\.com.*|^https:\/\/ecolab.*na.*\.visual\.force\.com.*
  • Regex dans le générateur de conditions : Données d'utilisateur → Variable → département → Est par expression régulière → ^sales$

Single character match

Most basic form of regex will do a direct character match.

Exemples

  • ^walkme$
    • Correspondra à « walkme »

Lists and ranges

[] can be used to specify a list of values and when combined with – can dictate a range of values a corresponding character in the target string can take.

Exemples

  • ^[dcr][ao][gt]$
    • Correspondra à « dog » « cat » « rat » « rag »
    • Le premier caractère doit être d, unc ou un r ; le deuxième caractère doit être un a ou un o, et le troisième caractère doit être un g ou un t
  • ^[a-z][0-9]$
    • Le premier caractère doit entre a et z (minuscule) et le deuxième caractère doit être entre 0 et 9

Repetitions

{3} and {#,#} can be used to avoid having to type the same patterns repeatedly in succession within a regex.

Exemples

  • ^[a-z]{3}$
    • Correspondra à trois lettres minuscules en séquence telles que « adf » ou « kzd »
  • ^[a-z]{1,3}$
    • Correspondra au minimum à un caractère et au maximum à trois des caractères précédents tels que « a » « am » et « abc », mais pas « duct »

Wildcards

These are useful if text in the target string is dynamic or if the contents do not matter.  . will match any single character, * will match zero or more of the preceding pattern, and + will match one or more of the preceding pattern.

Exemples

  • ^.*$
    • Correspond à zéro ou plusieurs caractères et est utile pour ajouter au début et à la fin d'une expression rationnelle (en particulier dans les extensions) parce que nous ne sommes intéressés que par la correspondance avec les sous-domaines.
  • ^a+b*c+$
    • Correspondra, car le + précise qu'au moins un des caractères précédents doit être présent

Escape character

The backslash \ denotes that the characters following it have special meaning.

Exemples

  • \.
    • Représente une période et non une wildcard
  • \/, $
    • Correspondra à un / et à un $
  • \d et \D
    • Correspond au caractère numérique\non numérique
  • \s et \S
    • Correspond au caractère avec espace/sans espace
  • \w et \W
    • Correspond au caractère alphanumérique/non alphanumérique

Exclusion character

When contained within [] ^ can denote that the character should not be present in the target string.

Exemples

  • ^[^abc]$
    • Correspondra à n'importe quel caractère unique qui n'est pas a, b ou c
  • ^[^n-p]$
    • Correspondra à n'importe quel caractère unique qui n'est pas n, o, ou p
  • ^\w[^og]{2}$
    • Correspondra à bee et sea mais pas à log, bog, fog, etc.

Negative lookahead

(?!) will specify that the following String should not be present in the match and is useful to, for example, prevent a WalkMe extension from injecting into the wrong iFrame.

Exemples

The pipe

| is the logical “OR” operator in regex and specifies a target string can match multiple patterns.

Exemples

  • ^.*ctmstech\.roche\.com/eclinical.*|.*ctms-performance\.roche\.com.*|.*siebelctmsqa\.kau\.roche\.com.*$

Redirect step

Useful when you want to create a redirect URL using BBCode.

https://app.[regex="\.(?<=\.)[a-zA-Z]*(?=\.)"][var]document.URL[/var][/regex].site.com/?cId=[regex="\d*"][jquery]INSERT JQUERY SELECTOR][/jquery][/regex]&pId=[regex="\d*"][jquery]INSERT JQUERY SELECTOR][/jquery][/regex]&r=/p/[regex="\d*"][jquery]INSERT JQUERY SELECTOR][/jquery][/regex]?tab=2&prId=asdf
Exemples

  • Exemple d'URL : https://app.test.site.com/?cId=12345&pId=67890&r=/p/67890?tab=2&prId=asdf

Using ChatGPT for Regex in WalkMe

Cet article a-t-il été utile?

Merci pour votre avis!

Be part of something bigger.

Engage with peers, ask questions, share ideas

Ask the Community
×
×