preg_match_all href|src function
| From: | Michael Elms | Date: | Mon, 03 Jun 2002 05:39:55 +0000 |
| Subject: | preg_match_all href|src function | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-100370@lists.php.net to get a copy of this message | ||
Hi All,
I have being working on PHP perl compaitable regular expressions for the last
month and cannot work out how to program a preg_match_all that will get the
"file.html" from the following examples:
<a href="file.html">
<a href='file.html'>
<a href=file.html>
<frame src="file.html">
<frame src='file.html'>
<frame src=file.html>
The preg_match_all I have below only works for <a href="file.html"> but not for
the other variations...
preg_match_all("|href=\"?([^\"' >]+)|i", $data, $links);
I tried the preg_match_all below, but that didn't work...
preg_match_all("|(href|src)=([^\"']+)?([^\"' >]+)|i", $data,
$links);
Any help would be greatly appreciated.
Regards,
Michael.