preg_match('/<a href="(.*?)"/i',$str,$reg);

Your URL will now be in $reg[1]

-Rasmus

On Sat, 15 Sep 2001, Boaz Yahav wrote:

> Hi
>
> How does one extract a URL from HTML like :
>
> <a href="/abc/def/0,1234,567.html?xxx=abcde" class="MyClass">
>
> I have an HTML file with many lines like this and I want to extract the
> /abc/def/0,1234,567.html?xxx=abcde part from each one.
> Assuming I can get the lines into an array, how can I extract only the
> URL part?
>
> I tried ereg but I'm not a wizard with RegEx.
>
> This is what I played with but I'm not sure how I can extract only the
> URL
>
>          If(ereg("<a href=",$Array[$i],$regs)){
>                  Echo $regs[0] . "<BR>";
>          }
>
>
> thanks
>
> berber
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to