Since the great comment and link to the great post Never parse markup with regex by @kjhughes in my previous question Regex repeat expression I have been changing as many unneeded regular expressions in my application which I used to remove content over writing a complete XPath.
But for the following I am wondering if there is also a way to solve it with XPath:
Data Name: Herr FirstName LastName
XPath so far: //body//div/div/table/tr/td/div/table/tr[3]/td/div/table/tr/td/p[1]/span/text()
Here I use following regex on: (?<=Herr |Frau ).*
This Because I only want the data Firstname LastName
The reason I am asking for again a name is that this are two different mails I am scraping with different templates and want the application to be modular.
At the moment I do this still quite often in the application that I just remove all unwanted text with a regex, for this reason I want to know if it is also possible with XPath. This way I learn more about the XPath scraping and do not harm unholy childs :)