I am trying to scrape a webpage for a person's name and am having trouble factoring in the possibility that a middle name may also be present. For example, if i am trying to match the name "John Smith" on a webpage and that page has the name with a middle name included (for example John Mark Smith or John M Smith or John M. Smith or JohnM.Smith), the search will turn up empty even though technically the first and last name are mentioned together on the page.
Is there a regex that can take into account a one word hop in the middle of matching the name? The name is in the variable:
$fullname = "John Smith";
How can i accomplish this?