mraza Posted October 1, 2010 Share Posted October 1, 2010 Hi I am trying to match all <font> tags in an html page but getting empty arrays. in my html page font tags look like this <font style="font-family:arial; color:#000000; font-size:18px; font-weight:bold;">Filename:</font> <font style="font-family:arial; color:#FF6700; font-size:22px; font-weight:bold;">filename.jpg</font><br /> and i tried with preg_match_all('%<\font[^>]*?style="[^"]*"[^>]*>(.*?)<\font>%si',$url,$match); Please any help.. Thanks Link to comment https://forums.phpfreaks.com/topic/214932-need-help-with-a-pattern/ Share on other sites More sharing options...
fortnox007 Posted October 1, 2010 Share Posted October 1, 2010 I just had a small glimpse but would this work? preg_match_all('%\<font[^>]*?style="[^"]*"[^>]*>(.*?)\<font\>%si',$url,$match); Link to comment https://forums.phpfreaks.com/topic/214932-need-help-with-a-pattern/#findComment-1118043 Share on other sites More sharing options...
mraza Posted October 1, 2010 Author Share Posted October 1, 2010 thx but its not working still getting empty array Link to comment https://forums.phpfreaks.com/topic/214932-need-help-with-a-pattern/#findComment-1118044 Share on other sites More sharing options...
mraza Posted October 1, 2010 Author Share Posted October 1, 2010 preg_match_all('%<font[^>]*>(.+?)</font>%si',$url,$match); Worked Link to comment https://forums.phpfreaks.com/topic/214932-need-help-with-a-pattern/#findComment-1118047 Share on other sites More sharing options...
fortnox007 Posted October 1, 2010 Share Posted October 1, 2010 preg_match_all('%<font[^>]*>(.+?)</font>%si',$url,$match); Worked hehe nice one : ) i thought the < had to be escaped glad it's solved after all Link to comment https://forums.phpfreaks.com/topic/214932-need-help-with-a-pattern/#findComment-1118049 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.