How to create and configure Slots

icon picker
Checking the format of the data entered by the bot user| Regular Expression slot and Result subslot

Purpose and general information

@Regular Expression Slot
is a
@Slot
that allows you to check the contents of the
@client_message
@Context Variable
for compliance with the format specified by a regular expression, and, depending on the match, move to the appropriate
@Script Branch
.
image.png
A
@Regular Expression Slot
is a
@Complex Slot
and cannot exist without its
@button
@Subslot
s, which starts its own
@Script Branch
, which will be branched into after the message has been checked against the regular expression.
The
@Regular Expression Slot
processes the contents of the
@Context Variable
@client_message
unchanged or converted to lowercase, depending on whether the Lowercase source message option is enabled in the
@Slot
.

Slot creation and settings

Slot attributes

image.png
Name — the name of the
@Slot
, which will be displayed in the Scenario Tree. The maximum length of a field value is 40 characters.
Lowercase source message option — an option that, when enabled, will convert the message in
@client_message
to lowercase.
Expression ー regular expression. Article about regular expressions:
Trimming spaces: by clicking the CREATE button (when creating a
@Slot
) or SAVE (when editing a
@Slot
), spaces and line breaks at the beginning and end of the Expression field are trimmed.

Subslots Result

Automatic generation of subslots when creating a Regular Expression slot

When creating a
@Regular Expression Slot
, two button
@Subslot
s are automatically generated with the values “true” and “false”.
image.png
These
@Subslot
s cannot be modified and can only be removed with a parent
@Regular Expression Slot
.
The location of
@Subslot
s is determined automatically;
@Subslot
s cannot be moved:
The
@result
@Subslot
with the value “false” is always the topmost
@Subslot
in this complex
@Regular Expression Slot
(if the line does not match the regular expression, then there is no point in further checking whether the
@Script Branch
of this subslot will be output - see Operation of the slot);
The
@result
@Subslot
with the value “true” is always the bottom-most
@Subslot
in a given
@Regular Expression Slot
.

Adding Result subslots

To create a new
@result
@Subslot
, you must click on the + button;
image.png
In the
@Subslot
you must enter the required value. This can be any string consisting of numbers, letters and symbols.
image.png
When the user creates new
@result
@Subslot
s containing the exact value, they will be located between the “true” and “false”
@Subslot
s from top to bottom in the order in which they were created.
image.png
When checking for an exact value, the ' and \ characters in the
@result
@Subslot
must be escaped: they must be preceded by a \ character, otherwise the
@Script Validation
will not be successful and the
@Agent
will not be trained. Read more: .
image.png

Removing subslots Result

To remove a
@result
@Subslot
, you need to right-click on it and click the Remove Branch button, then click OK in the pop-up dialog box.
image.png
image.png
It is possible to delete only manually created
@result
@Subslot
s.
Deleting automatically generated
@result
@Subslot
s with true and false values is not possible. When you try to do this, the following error will appear at the bottom center:
image.png

Result subslot attributes

image.png
Name — the name of the
@Slot
, which will be displayed in the
@Script Tree
. The maximum length of a field value is 40 characters. If no name is entered, the
@Subslot
in the
@Script Tree
will display the first 34 characters from the Value field.
Value — the string with which the value of the
@client_message
@Context Variable
will be compared.

Slot content

The
@Slot
must contain a Python regular expression. Examples of regular expressions commonly used in
@Agent
s:
Only numbers:
^[\d]+$
Only Latin letters, numbers, hyphens
^([A-Za-z0-9-]+)$
E-mail address
[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+
URL
(https?:\/\/)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\ b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)
Search for one of the substrings in a string
.*(substring1|substring2).*
Important: Using masks in the
@Regular Expression Slot
is not supported.

Slot operation

The
@Agent
makes a copy of the contents of the
@client_message
@Context Variable
.
If the Lowercase source message option is enabled in the
@Slot
, the
@client_message
value is converted to lowercase. If the option is disabled, the value remains unchanged.
The resulting value is checked for compliance with the regular expression specified in the
@Regular Expression Slot
. The result of the check may be:
false — the
@client_message
value does not match the regular expression,
this will create a
@System Context Variables
@error
containing the error text.
true — the value of the
@Context Variable
@client_message
matches the regular expression
In this case, the
@Context Variable
@parse_result
will be created, where the part of
@client_message
corresponding to the regular expression will be written, incl. this can be the entire contents of
@client_message
;
if there are several substrings in
@client_message
that match the regular expression, the first corresponding substring will be written to the
@Context Variable
@parse_result
;
Exit from the
@Complex Slot
@Regular Expression Slot
+
@result
: the check result is sequentially compared from top to bottom with the values in the result
@Subslot
s and the transition is made to the corresponding
@Script Branch
, the following checks are performed:
Regular Expression Mismatch: if the test result is false, then a transition will be made to the
@Script Branch
of the topmost
@Subslot
result with the value “false”;
Match exact value: if the test result is true and there are user-created
@result
@Subslot
s to test for an exact match, then a transition will be made to the
@Script Branch
of the first
@Subslot
whose value matches
@client_message
;
Regular expression matching: if the test result is true and there are no
@result
@Subslot
s to check for an exact match, or the values in them do not match the
@client_message
, then the
@Script Branch
of the lowest
@result
@Subslot
with the value “true".
image.png
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.