On Thu, May 29, 2008 at 2:07 PM, Chris W <[EMAIL PROTECTED]> wrote:
> What I want to do is find all links in an html file. I have the pattern
> below. It works as long as there is only one link on a line and as long as
> the whole link is one line. It seems there should be a way to get this to
> work with more than one link on a single line. The work around I have done
> for now is to read the whole file into a buffer and remove all new lines and
> then add a new line after every closing a tag. Then process each line.
> There has to be a better way.
>
> Any Ideas? Also note I don't want to find any a tags that don't have an
> href.... there probably aren't any but just in case.
>
>
> preg_match_all("/(< *a[^>]*href[^>]+>)(.*)<\/a>/", $Line, $matches,
> PREG_PATTERN_ORDER);
>
> --
> Chris W
> KE5GIX
>
> "Protect your digital freedom and privacy, eliminate DRM, learn more at
> http://www.defectivebydesign.org/what_is_drm"
>
> Ham Radio Repeater Database.preg_match_all("/(<
> *a[^>]*href[^>]+>)(.*)<\/a>/", $Line, $matches, PREG_PATTERN_ORDER);
> http://hrrdb.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Why not use DOMDocument with getElementsByTagName('href') [1]
http://us2.php.net/manual/en/domdocument.getelementsbytagname.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php