Use custom regular expression slot types in a bot flow
In addition to built-in slot types, Architect supports four custom slot types: list slot type, dynamic list slot type, regular expression slot type, and if you enable Virtual Agent, AI-powered slots. Use regular expressions (regex or regexp) to identify patterns in utterances that match a specific sequence of characters. Regex is useful if you want to capture strings with different letter and digit combinations such as unknown names, IDs, flight numbers, or license numbers.
For example, if you want to match flight codes for your travel bot, you must know the flight number for handling any cancellations. The regex pattern, ^[A-Z]{2}\d{3,4}$ matches any phrase in the utterance that matches this pattern as a flight number. For more information, see Regular expression language quick reference.
Add a custom regular expression slot type
To add a custom regular expression slot type, follow these steps:
- Under Natural Language Understanding, click Slots.
- Click Add Slot.
- Provide a meaningful name for the slot.
- Under Slot Type, click New RegEx.
- Type a meaningful name for the custom RegEx slot type.
- Click Add or press Enter.
- Click the new RegEx slot type.
- Add slot type values as needed.
- Click the new slot list type.
- In the Type a new regular expression here box, enter the regular expression parameters.
Test a regular expression
You can test a regular expression slot type before you publish your flow. For more information, see Test a regular expression slot type.
Modify a slot
To modify slot information, from the Slot menu, select a slot and click Edit .
Delete a slot
To delete a slot, from the Slot menu, select a slot and click Delete .