I’m scraping customer information from emails and have been using string manipulation in order to get the customer’s first and second names, as well as their email.
An issue I am facing is that some times customers include their middle names too and so I scrape their middle name as their last name and last name as their email.
Eg: I have coded for the three fields below (first/last/email)
Customer Details: John Smith Johnsmith@email.com
But if the customer writes:
Customer Details: John Steven Smith johnsmith@email.com
Then I get Steven as the surname and smith as the email.
Is there a simple way I can get the bot to tell if there is an email address or a third name to tell that it is the surname? Perhaps something using the @ in email as an identifier?
Thanks for this; I understand RegEx would get the email, but then how would the bot know the difference between if a middle name/last name exists or not?
I understand your doubt, in email the format would be username@gmail.com. We have set the regex to retrieve only the email id by selecting Email option in the dropdown of the RegEx Builder. So, this RegEx will only retrieve the email id from the text.
If you need to retrieve the lastname and middle name, then there is another regex to retrieve those.