Regex Slots
Description and how to use the Regex slots
Last updated
Description and how to use the Regex slots
Last updated
Regex Slots offer a robust way to validate specific types of user input in Parloa's platform. Through the use of Regular Expressions (Regex), you can ensure that the data provided by the user meets certain criteria or follows a specific format.
For instance, if a customer calls and says, "Hi, my customer number is KV U 3 3452363
, is this correct?", a Regex Slot could be used to validate the format of the provided customer number.
Add to Speech Assets: First, you'll need to add a Regex Slot to your Speech Assets in Parloa.
Define the Regex Pattern: In the Regex Slot, specify the pattern that you want to validate.
For instance, a simplified Regex pattern to match the customer number could look something like this:
This slot enables the validation of Parloa slot function values using regular expressions (Regex). For example, a client could call and use their customer number as follows:
Hi, my customer number is KV U 3 3452363, is this correct?
Once added to your Speech Assets, you must define the RegEx pattern that the slot should identify.
You can create multiple Regex slots within your Speech Assets for different expressions, as well as add multiple expressions within a Regex slot (for example, if there are multiple formats for customer numbers).
Here is an example of a simple expression:
Let's break down the pattern:
The following table provides some essential regex syntax that can be useful for you:
Syntax | Description |
---|---|
A
Matches the literal character 'A'.
[ -]?
Specifies an optional space or hyphen character.
\d{7}
Matches exactly seven digits.
.
Matches any single character except a newline.
\d
Matches any digit (0-9).
\D
Matches any non-digit character.
\w
Matches any word character (alphanumeric or underscore).
\W
Matches any non-word character.
\s
Matches any white space character.
\S
Matches any non-whitespace character.
[abc]
Matches any character inside the brackets.
[^abc]
Matches any character not in the specified set (not a, b, or c).
*
Matches zero or more occurrences of the preceding element.
+
Matches one or more occurrences of the preceding element.
?
Matches zero or one occurrence of the preceding element.
{n}
Matches exactly n occurrences of the preceding element.
{n,}
Matches n or more occurrences of the preceding element.
{n,m}
Matches between n and m occurrences of the preceding element.
^
Matches the start of a string.
$
Matches the end of a string.
()
Groups multiple elements together and captures the matched text.
`
`
\
Escapes a special character to be treated as a literal character.