preg_match_all

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux