generous-apricot
generous-apricot2y ago

Hi everyone, I am having trouble to capture entity like {PIN} pin is XyZx99 format.

It is alphanumerical value, starts with 4 letters, uppercase lowercase sensitive, and ends with 2 numbers. - I created values like 20 examples of values. - However, it doesn't capture the value for example kkkk99. It captures just "k" - Why would that happen? Is it because I need to input hundreds of example values in the entity configuration? I appreciate the help, thank you in advance.
3 Replies
W. Williams (SFT)
Use a regex in a Javascript block instead:
last_utterance = last_utterance.trim()

const regex = /^[A-Za-z]{4}\d{2}$/
return regex.test(last_utterance) ? 'default' : 'error'
last_utterance = last_utterance.trim()

const regex = /^[A-Za-z]{4}\d{2}$/
return regex.test(last_utterance) ? 'default' : 'error'
Make sure to add the "error" path to the javascript step.
generous-apricot
generous-apricotOP2y ago
Hey W.Williams. Thanks for the help, I'll do it as you advised. Would that mean I shouldn't rely on any custom capture functionality in voiceflow and do it always by regrex?
W. Williams (SFT)
sorry, that new one is better

Did you find this page helpful?