View Full Version : RegExp issue preg_match_all

11-10-2006, 06:36 PM
$html = file_get_contents("http://en.wikipedia.org/wiki/Wikipedia:Featured_articles");
$pattern = '(\<span class\=\"featured\_article\_metadata has\_been\_on\_main\_page\"\>\<a href\=\").*([\w]+)(\" title\=\".*[\w]+\"\>.*[\w]+\<\/a\>\<\/span\>)';
$outputArray = preg_match_all($pattern,$html,$matches);

i run this and receive

Warning: preg_match_all(): Unknown modifier '.' in /home/www/roblem.100webspace.net/Wiki.php on line 4
Array ( )

Any ideas?

i need to pull things from the wikipedia page for personal use but am too lazey too do it by hand, if you were wondering why i'm doing this.

11-10-2006, 07:28 PM
try this regexp.

$outputArray = preg_match_all('/(?<=<span class="featured_article_metadata has_been_on_main_page">).*?(?=<\/span)/is', $html, $matches);

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum