Need help with Regex

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • G. Delavaquerie

    #1

    Need help with Regex

    I'm becoming nuts with regex and preg_match_all. I hope someone could help ...
    Here is my problem :

    Match</td>
    <td align="center" valign="middle" class="textnoir ">final</td>
    <td align="center" valign="middle" class="textnoir ">mi temps</td>
    <td align="center" valign="middle" class="textnoir ">en cours</td>
    <td align="center" valign="middle" class="textnoir ">P</td>
    </tr>

    I want to extract
    <td align="center" valign="middle" class="textnoir ">final</td>
    <td align="center" valign="middle" class="textnoir ">mi temps</td>
    <td align="center" valign="middle" class="textnoir ">en cours</td>
    <td align="center" valign="middle" class="textnoir ">P</td>

    I tried :
    preg_match_all ('/Match<\/td>(.*?)<\/tr>/', $page_html, $titre);

    and many more things but nothing works. I suspect <, >, </ to be the problem.

    The one who gives me solution will have my gratitude for eternity !

    Many thanks,

    Gaelle
  • Jan Pieter Kunst

    #2
    Re: Need help with Regex

    In article <c10b9318.04040 40254.29da5891@ posting.google. com>,
    nicolas_gaelle@ yahoo.fr (G. Delavaquerie) wrote:
    [color=blue]
    > The one who gives me solution will have my gratitude for eternity ![/color]

    Here you go:

    preg_match_all( '/Match<\/td>(.*?)<\/tr>/s', $page_html, $titre);

    Note the /s modifier after the pattern. This allows . to match a
    newline, in this case the newline after the first </td>.

    JP

    --
    Sorry, <devnull@cauce. org> is een "spam trap".
    E-mail adres is <jpk"at"akamail .com>, waarbij "at" = @.

    Comment

    • G. Delavaquerie

      #3
      Re: Need help with Regex

      You are The One !

      So many thanks !


      Jan Pieter Kunst <devnull@cauce. org> wrote in message news:<devnull-1320A1.13061104 042004@news1.ne ws.xs4all.nl>.. .[color=blue]
      > In article <c10b9318.04040 40254.29da5891@ posting.google. com>,
      > nicolas_gaelle@ yahoo.fr (G. Delavaquerie) wrote:
      >[color=green]
      > > The one who gives me solution will have my gratitude for eternity ![/color]
      >
      > Here you go:
      >
      > preg_match_all( '/Match<\/td>(.*?)<\/tr>/s', $page_html, $titre);
      >
      > Note the /s modifier after the pattern. This allows . to match a
      > newline, in this case the newline after the first </td>.
      >
      > JP[/color]

      Comment

      Working...