Connecting Tech Pros Worldwide Help | Site Map

Regular expressions to get userid in an html file

  #1  
Old September 30th, 2005, 08:05 PM
thierry@sockho.com
Guest
 
Posts: n/a
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

  #2  
Old October 1st, 2005, 03:25 PM
alex
Guest
 
Posts: n/a

re: Regular expressions to get userid in an html file


<thierry@sockho.com> a écrit dans le message de news:
1128106558.688938.280070@g49g2000cwa.googlegroups. com...[color=blue]
> 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
>[/color]

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


Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
$_SESSION / $HTTP_SESSION_VARS behaviour Michael Windsor answers 12 November 7th, 2006 01:15 PM