Regex
| From: | Boaz Yahav | Date: | Sat, 15 Sep 2001 20:33:05 +0000 |
| Subject: | Regex | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-67458@lists.php.net to get a copy of this message | ||
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