Please help out with a RegEx

Discussion in 'PHP' started by adrianctn, Jan 27, 2007.

  1. #1
    Hello guys.

    Please help me out with a little regular expression thingy. I will give you some "green rep" if you help out.

    I have webpages that looks like this:

    
    ....html code....
    <td style="height:81%;width:100%;padding:0;text-align:left;">Text and code that I want to capture</td>
    ....html code....
    
    PHP:
    I am using this to capture the text&code:
    $pattern = '%<td style="([^"]+)">(.+?)</td>%';
    PHP:
    But the pattern is not working properly. Please help out.

    Thank you for your help.

    Kind regards,

    Adrian
     
    adrianctn, Jan 27, 2007 IP
  2. lmoss

    lmoss Peon

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Does this one work better?

    $pattern = '%<td style="([^"]+)">([^<]?)</td>%';
    Code (markup):
     
    lmoss, Jan 27, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    Try replacing this.
    
    </td>
    
    Code (markup):
    with
    
    <\/td>
    
    Code (markup):
     
    nico_swd, Jan 28, 2007 IP