A regular expression is a search pattern. It can find a fixed string or match several similar inputs, such as all phone numbers with a particular prefix. Whether a pattern matches also depends on where you use it.
Where patterns are used
| Location | What is checked? | Particular behavior |
|---|---|---|
| Banned contacts | phone number, sender address or name, depending on the channel | A match excludes the contact; matching is case-sensitive. |
| VIP class filters | the sender of the conversation | The filter applies only to the configured skills and channels. |
| Boilerplate best match filters | the customer’s message | Both the pattern and message are converted to uppercase before matching; see below. |
| Word recognition | recognized words, then the recognized text | A connected output’s display text is the pattern. Matching is not case-sensitive. |
Basic syntax
Without special characters, a pattern searches for the text you write:
rechnung also finds “Abrechnung”. A match anywhere in the input is enough.
Use anchors to require a particular beginning or a complete input.
| Character | Meaning | Example |
|---|---|---|
^ |
beginning of the input | ^0900 — starts with 0900 |
$ |
end of the input | @example[.]com$ — ends with this domain |
[0-9] |
one digit | ^[0-9]+$ — digits only |
[abc] |
one of the listed characters | [abc] — a, b or c |
[^0-9] |
a character that is not a digit | [^0-9] — finds a plus sign or space, for example |
. |
one character other than a newline | a.b — for example “a-b” |
* |
the preceding character or group any number of times, including zero | [0-9]* |
+ |
the preceding character or group at least once | [0-9]+ |
? |
the preceding character or group zero or one time | storno? — “storn” or “storno” |
{n} |
exactly n repetitions | [0-9]{5} — five digits |
{n,m} |
n to m repetitions | [0-9]{2,4} — two to four digits |
| |
alternative | rechnung|abrechnung |
(…) |
a group | (rechnung|storno) |
\ |
removes the special meaning of the next special character | \+49 — a literal plus sign followed by 49 |
An unescaped dot stands for any character. Write \. or [.] for a literal
dot. In a filter field, escaping requires only one backslash; do not put
quotation marks around the whole pattern.
Phone number and address examples
| Pattern | Matching example | Non-matching example |
|---|---|---|
^0900 |
0900123456 |
0890900123 |
^\+4989 |
+49891234567 |
+49301234567 |
^\+49891234567$ |
+49891234567 |
+498912345678 |
@example[.]com$ |
kunde@example.com |
kunde@exampleXcom |
^[0-9]{5}$ |
12345 |
123456 |
Use the format that actually appears in the conversation. ^\+4989 does not
match 0891234567; the filter does not add a country code or remove spaces.
Check the transmitted number in the conversation overview before defining
a filter.
Boilerplate best match filters
Best match filtering converts both the message and pattern to uppercase.
rechnung therefore finds “Rechnung” as well as “RECHNUNG”.
This conversion also affects letters in special shorthands: \d becomes
\D, \w becomes \W and \b becomes \B. Their meaning changes as a
result. Use simple search words, alternatives and character classes here:
rechnung|abrechnungfor the two words;kundennummer[ :]*[0-9]+for “Kundennummer: 12345”;[0-9]{5}for a sequence of five digits.
Options containing letters inside the pattern are converted as well. Do not copy an expression from a general regex tool into this field without testing it there.
A match alone does not select the boilerplate. The weights of all matching filters are added for the conversation’s language; the Agent then sorts the suggestions.
Word recognition
For word recognition, the pattern is the output’s Display text.
rechnung|abrechnung matches both words. To match “ja” as a separate word
only, use \bja\b; this finds “ja” but not “Januar”. This shorthand remains
intact here because matching converts both the pattern and text to lowercase.
If several outputs match, the flow continues through the first matching connected output. An unconnected output is not an executable branch. Check the order as well if a general pattern precedes a more specific one.
Testing a pattern
- Take at least one actual input that should match and one that should not. Add similar-looking counterexamples.
- Check the syntax first. An open
[or(is not a complete pattern. - Under Banned contacts, enter the input in Test entry. An invalid pattern turns the pattern field red; a non-match turns the test entry red.
- Test VIP filters with the actual transmitted sender information and boilerplate filters with a message in the configured language.
- Test word recognition with a call, including a sentence that should not match any output. Pronunciation and recognized text may differ.
A syntactically valid pattern can still be too broad. 0900 finds these
digits anywhere in a number; ^0900 only at the beginning. Patterns such as
.* match practically every input and are unsuitable for targeted exclusions.