i have what is probably a very simple question dealing with preg_match... but i have never used preg_match before so please forgive me if its a dumb question
i have a file being put into a string via file_get_contenst as follows.... $str = file_get_contents($url); (where URL is some predefined URL)... i want to search the string for a certain occurance of a name and then grab that name from the string
ill be searching for name by the last name, but ill want to grab the full name.... in the string the name will be as follows: Smith, John.... when i search for "smith" i want to find "Smith, John" and then assign "Smith, John" to some variable so i can store it in a table
now i know that with regex i can do this, but im not sure how to account for the comma and space after the name.... also i wont know before hand what the first name will be so i couldnt do something like: preg_match( "/Smith.*n/", $source, $array ) because i dont know that the first name will end with a "n" (also this wouldnt get the full name of "Smith, Nancy", it would only return "Smith, N" (i think anyhow
can somebody tell me how to create my regex to account for the first name, comma and space? thanks a bunch in advance