Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Senior Coder
    Join Date
    Apr 2005
    Posts
    1,051
    Thanks
    0
    Thanked 0 Times in 0 Posts

    RegExp issue preg_match_all

    PHP Code:
    <?
    $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);
    print_r($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.
    public string ConjunctionJunction(string words, string phrases, string clauses)
    {
    return (String)(words + phrases + clauses);
    }
    <--- Was I Helpfull? Let me know ---<

  • #2
    New Coder
    Join Date
    Jun 2006
    Location
    Sweden
    Posts
    49
    Thanks
    0
    Thanked 3 Times in 3 Posts
    try this regexp.

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •