Regular Expression

Discussion in 'PHP' started by hoangthienphuc, Aug 16, 2007.

  1. hoangthienphuc

    hoangthienphuc New Member

    Joined:
    Mar 15, 2007
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    I had a html content like this :
    HTML:
      <tr>
               <td colspan="4">
               <p align="center">
     <img src="chart10.chart?no_cache=5608" %>
      </tr>
    and i saved the above content in $content
    I used :
    PHP:
     preg_match_all("/(<td colspan=\"4\">(.*?)<\/td>)/",$content$match);
    and then print_r($match);
    and it display : Array ( [0] => Array ( ) [1] => Array ( ) [2] => Array ( ) ) :confused:
    I dont know what's problems here, please help me ( Although i have tried to use preg_match instead of pre_match_all)
     
    Last edited by a moderator: Aug 18, 2007
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    you don't have closing td tag, add that and the regex should work fine!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice