Search code examples
regexentitydialogflow-esmessagedetect

Dialogflow regex entity does not capture message phrase


I have a message send to DialogFlow, look like: I wanna go to <@U12A0GF233T> and I want DialogFlow can detect U12A0GF233T as an entity.
So I created an entity @place with value ^\<@([A-Z])\w+\>.
But when the message was recived, dialogFlow can not detect @place.
I tested my regex on https://regexr.com/, it's work, but it doesn't work on DialogFlow.
Did I make some mistake here?


Solution

  • Basically Google Dialogflow leverages RE2 C++ library for the regular expressions associated with the entity, that might change slightly the general regexp dialect, just follow this RE2 Syntax page.

    In the explained use case, I've finished up regexp pattern adjusting either with:

    ^*<@([A-Z]\w+)>

    Or

    \<@([A-Z]\w+)>