I’m trying to implement an extraction of the last name of a client with the Regex Expressions Extractor on a scanned document.
Sometime the words Agent and Insurance Agent do not appear so I have tried to set it up to look for either or. I did this by making Agent a capture group and then adding a true/false condition to the Insurance Agency.
The problem here is that the UiPath Extractor extracts everything and appears as AgentLastname. When I only want it to extract Lastname, Since I had to make Agent a capture group It extracts that as well. How should I approach this problem?
(?'Agent’Agent)\s+?\n+?(?:\w+)\s+(?:\w+.?\s{1,3})?([a-zA-Z0_]+)\s+?(?(Agent)\s?|Insurance Agency.)
Here is an example text.
"Policy Holder
Agent
First Middle Last Insurance Agency."