0

I should preface this by saying that I am in no way a coder. I have a rudimentary understanding of coding, the rest I deal with by reading up and simply thinking through it logically.

I am trying to create an entity in Dialogflow ES to recognise when an utterance contains an email address (No requirement to extract or use said email, simply recognise it) while also determining that the email is not my own company email. For instance

[\w]+\@(?!companyname)[\w]+\.?[\w]+\.?[\w]+\.?[\w]{2,4}

Here you can see the regex entity will recognise if an utterance contains the characters:

word@word.com and I can respond with a simple "I can't take your email information on this bot."

However, if the customer enters help@companyname.com the regex will not pick up on this. This is because I already have an entity that confirms my company email.

My problem is that DF doesn't seem to be able to accept (?!) as an input for a regex. Is there another way that I can do this?

  • Did you try using the dialogflow provided `@sys.email` entity? https://cloud.google.com/dialogflow/es/docs/reference/system-entities – Ricco D Aug 10 '21 at 01:10
  • The email entity will only pick up any email entered, which is fine, but as stated, I want to be able to differentiate between customer emails and the company email in the utterances, so that the bot can recognise when an utterance is intended as "This is my email" and "Is this email correct?" – Michael Archer Aug 10 '21 at 13:27
  • This might help you out on an alternative for the negative lookahead https://stackoverflow.com/a/26792316/14733669. Based from this answer, can you try `[\w]+\@([^c]|c[^o]|co[^m]|com[^p]|comp[^a]|compa[^n]|compan[^y]|company[^n]|companyn[^a]|companyna[^m]|companynam[^e])\w+\.?[\w]+\.?[\w]+\.?[\w]{2,4}` ? – Ricco D Aug 12 '21 at 03:20

0 Answers0