* Thus wrote Mike J ([EMAIL PROTECTED]): > I want to pull the title (<title>example</title>) of a webpage out of some text. The > end result being "example". What preg function should I use and can someone give me > the the code that will do it? >
preg_match is what you want. And if you poke around the preg_* section abit you'll see that preg_match_all has exactly what you want: /* match all <html>content</html> matches */ preg_match_all ("/(<([\w]+)[^>]*>)(.*)(<\/\\2>)/", $html, $matches); Ahh.. but you say... I only want the title tag... so changing the regex to this: preg_match_all ("/(<title>)(.*)(<\/\\2>)/i", $html, $matches); Add the 'i' flag for case INsensitivity, you have your solution.. easy eh? I'll let ya do the rest :) HTH, Curt -- "My PHP key is worn out" PHP List stats since 1997: http://zirzow.dyndns.org/html/mlists/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php