Connecting Tech Pros Worldwide Forums | Help | Site Map

Need help with Regex

G. Delavaquerie
Guest
 
Posts: n/a
#1: Jul 17 '05
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
Guest
 
Posts: n/a
#2: Jul 17 '05

re: Need help with Regex


In article <c10b9318.0404040254.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" = @.
G. Delavaquerie
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Need help with Regex


You are The One !

So many thanks !


Jan Pieter Kunst <devnull@cauce.org> wrote in message news:<devnull-1320A1.13061104042004@news1.news.xs4all.nl>...[color=blue]
> In article <c10b9318.0404040254.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]
Closed Thread