Use custom regular expression slot types in a bot flow

In addition to built-in slot types, Architect supports three custom slot types: list slot type, dynamic list slot type, and regular expression slot type. 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:

  1. Under Natural Language Understanding, click Slots.
  2. Click Add Slot.
  3. Provide a meaningful name for the slot.
  4. Under Slot Type, click New RegEx.
  5. Type a meaningful name for the custom RegEx slot type.
  6. Click Add or press Enter. 
  7. Click the new RegEx slot type.
  8. Add slot type values as needed.
  9. Click the new slot list type.
  10. In the Type a new regular expression here box, enter the regular expression parameters.

    Click the image to enlarge.

    Regular Expression slots

    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 .