PDA

View Full Version : preg_match_all


wilhelm32
12-23-2006, 07:59 PM
Hello I'm having some trouble trying to get some matches of this text

James Gosling, Ph.D (born May 19, 1955 near Calgary, Alberta, Canada) is a famous software developer, best known as the father of the Java programming language.

If I was looking in a string for "James Gosling" how can I do to get that match with preg_match_all?

Is there a way to find two words on a text, or it has to be word by word? What if I really need to match a full name?

nico_swd
12-24-2006, 09:58 AM
preg_match('/^([^\,]+)/', $your_text, $match);

echo $match[1];


Untested.