You are here: Re: Regular expressions to get userid in an html file « PHP Programming Language « IT news, forums, messages
Re: Regular expressions to get userid in an html file

Posted by alex on 10/01/05 17:20

<thierry@sockho.com> a ιcrit dans le message de news:
1128106558.688938.280070@g49g2000cwa.googlegroups.com...
> Hi,
>
> I would like to parse an html file containing several link with userid
> in order to retrieve all userid and put them into an array.
>
> Here is what my html looks like :
>
> ...r"><a href="userprofile.php?userid=346047" ><img s...
>
> And want : array("346047", ...);
>
> I am playing with RegEx without success.
>
> Do you have an idea ?
>
> Thanks a lot for your help.
>
> thierry
>

preg_match_all('/<a href="userprofile\.php\?userid=([\d]+)">/',
$YourHtmlCode, $RegTable) should help you I think.

I didn't test it. Maybe you'll have to escape the <, > and " characters.

--
alex

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация