SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jul 2008
    Posts
    255
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Preg_match not finding a string.

    I am trying to extract a table from HTML, here is the HTML code for the start of the table.

    Code:
    <table class='price' id='comp' style='clear:both;display:none'>
    But when I use this PHP code, no matches are found

    Code:
    preg_match("/<table class='price' id='comp' style='clear:both;display:none'>.*?<\/[\s]*table>/s", $buffer, $matches);
    print_r($matches);

    I guess there is something wrong with the preg_match statement?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,494
    Mentioned
    161 Post(s)
    Tagged
    4 Thread(s)
    It works fine for me with this test string:
    Code:
    abc<table class='price' id='comp' style='clear:both;display:none'><tr><td></td></tr></table>abc


Bookmarks

Posting Permissions

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