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 Quote 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); Quote 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 Quote 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 Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.