With Regex Entities, you can extract your intended alphanumeric values using the following:
Set your regex entity entry to ‘\s\w*\d+\w*\s‘.
Add your regex to an intent’s training phrase:
Example:
If you wish to capture the regex on a form parameter, use the following:
Set your regex entity entry to ‘^\w*\d+\w*$’.
Set up your agent to prompt the user into entering only the alphanumeric value:
Example:
For similar regex entries, please utilize the ‘^’ and ‘$’ specifiers. These make it clear that the entity is to be checking if the whole query matches, and sufficiently resolves the “regex is too broad” error.
You can add both ‘\s\w*\d+\w*\s‘ and ‘^\w*\d+\w*$’ as entries to the EntityType to cover both situations. Be sure to check the Dialogflow documentation for further tips. You can also check the Regular Expression Syntax documentation.