pattern values

/* Title: Entity Pattern Values Sort: 5 */ You can give an entity a number of values in order to recognise parts of a user utterance, and use them for validation when gathering information in Flow.

Pattern values are used when you want to allow a wider range of inputs, but still restrict them to a pattern. This is achieved using regular expressions (regex). So, you could assign the entity @imageURL a pattern named JPG | GIF | PNG | SVG that contained the following regex :

(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|gif|png|svg)

This would reject any user input that didn’t conform to this regex pattern, i.e. a URL that ends with a specified file type.


In the following step-by-step example, we will :-

  • Select an Entity

  • Add a Pattern Value

Select an Entity

From the Entity list page, select an entity and click Create Value (If the entity has no values yet, the sidebar will be automatically opened, showing the Text Value & Pattern Value types to choose).

Add a Pattern Value

Choose the Pattern value type from the sidebar

Enter in the sidebar -

  • Value Name Name the value. All value names must be unique within the entity. This is just a label for the regex pattern(s) added to this value.

  • Pattern (optional) Add a regex (regular expression) for this value. All Patterns must be unique within the Pattern Value. Any user inputs that conform to the regex pattern will be accepted and stored.

    Add multiple Patterns as required

Click Create Value

Your new pattern value will be shown in the value list under it's entity