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.
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:
Outline possible values you want to match and values you do not want to match
Break the problem down into multiple groups of rules which, when combined, encompass all values you want to match
In this example we have four different patterns we want to match:
Any dates during January 2019
Any date between January 1, 2010 and December 31, 2018
Any date between January 1, 2000 and December 31, 2009
Any date between January 1, 0000 and December 31, 1999
Form the rules to handle each of the above cases and test them:
^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}$
After testing each group, combine into one string using the pipe (remove excess ^ and $s)
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}$
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]
Anmerkung
{Text zur Durchführung der Regex} kann eine Mischung aus mehreren dynamischen Textwerten wie Variablen, Cookies, WalkMe Daten und jQuery sowie statischen Werten sein
Der Großteil, wenn nicht alle Textverwendungen in Regex werden dynamisch sein, mit minimaler Verwendung von statischen Textwerten.
Unterstützte Verwendung von Regex bei WalkMe
Bedingungs-Builder-Regeltypen:
Ausgewähltes Element
URL
Benutzerattribute
jQuery
Auf dem Bildschirmelement
Variable (Benutzerdaten)
BBCode für WalkMe-Inhalte:
Visuelle Anzeige
Smart Walk-Thru Schritt
ShoutOut
Anleitung SmartTip
Survey
Automatisierung
Smart Walk-Thru Auto-Schritt (Text einfügen und Listenwert auswählen);
Umleitungsschritt für Smart Walk-Thrus
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.
Beispiele
In einem Erweiterungspaket: ^https:\/\/ecolab\.my\.salesforce\.com.*|^https:\/\/ecolab.*na.*\.visual\.force\.com.*
Regex im Bedingungs-Builder: Benutzerdaten → Variable → Abteilung → Ist pro regulären Ausdruck → ^sales$
Single character match
Most basic form of regex will do a direct character match.
Beispiele
^walkme$
Wird „walkme„ entsprechen
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.
Beispiele
^[dcr][ao][gt]$
Passt zu „Hund„ „Katze„ „Ratte„ „Lappen"
Das erste Zeichen muss d, c oder r sein; das zweite Zeichen muss a oder o sein, und das dritte Zeichen muss g oder t sein
^[a-z][0-9]$
Das erste Zeichen muss a bis z (Kleinbuchstaben) sein und das zweite Zeichen muss 0 bis 9 sein
Repetitions
{3} and {#,#} can be used to avoid having to type the same patterns repeatedly in succession within a regex.
Beispiele
^[a-z]{3}$
Stimmt mit drei Kleinbuchstaben in Folge überein, z. B. „adf„ oder „kzd„.
^[a-z]{1,3}$
Stimmt mit mindestens einem und höchstens drei der vorangehenden Zeichen überein, z. B. „a„ „am„ und „abc„, aber nicht „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.
Beispiele
^.*$
Entspricht Null oder mehr oder beliebigen Zeichen und ist nützlich, wenn es am Anfang und am Ende einer RegEx eingefügt wird (insbesondere innerhalb von Erweiterungen), da wir nur an passenden Subdomains interessiert sind
^a+b*c+$
Entspricht, da + angibt, dass mindestens eines der vorangehenden Zeichen vorhanden sein muss
Escape character
The backslash \ denotes that the characters following it have special meaning.
Beispiele
\.
Steht für einen Punkt und nicht für einen Platzhalter
\/, $
Passt zu a / und $
\d und \D
Entspricht einem numerischen und einem nicht numerischen Zeichen
\s und \S
Passt zu einem Leerzeichen\Nicht-Leerzeichen
\w und \W
Passt zu einem alphanumerischen und nicht alphanumerischen Zeichen
Exclusion character
When contained within [] ^ can denote that the character should not be present in the target string.
Beispiele
^[^abc]$
Passt zu jedem einzelnen Zeichen, das nicht a, b oder c ist
^[^n-p]$
Passt zu jedem einzelnen Zeichen, das nicht n, o oder p ist
^\w[^og]{2}$
Passt zu bee und sea, aber nicht zu log, bog, fog usw.
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.