jjmusicpro Posted December 15, 2010 Share Posted December 15, 2010 I cant get this to work for some reason... just kicks out blank... Code preg_match('/<div class=\"c\"><strong>(.*?)<\/strong><\/div>/i', $result, $name); echo $name[0]. " " .$name[1]; I even tried this preg_match('/<div class=\"c\"><strong>([^\<]*)<\/strong><\/div>/i', $result, $name); echo $name[0]. " " .$name[1]; HTML <div class="c"><strong>My Cool Name</strong> I want to get "My Cool Name" out of that... Link to comment https://forums.phpfreaks.com/topic/221718-simple-regex-with-sample-and-html-not-working/ Share on other sites More sharing options...
jjmusicpro Posted December 15, 2010 Author Share Posted December 15, 2010 Figured it out, didnt see i had the extra <div> at the end preg_match('/<div class=\"c\"><strong>([^\<]*)<\/strong>/i', $result, $name); I cant get this to work for some reason... just kicks out blank... Code preg_match('/<div class=\"c\"><strong>(.*?)<\/strong><\/div>/i', $result, $name); echo $name[0]. " " .$name[1]; I even tried this preg_match('/<div class=\"c\"><strong>([^\<]*)<\/strong><\/div>/i', $result, $name); echo $name[0]. " " .$name[1]; HTML <div class="c"><strong>My Cool Name</strong> I want to get "My Cool Name" out of that... Link to comment https://forums.phpfreaks.com/topic/221718-simple-regex-with-sample-and-html-not-working/#findComment-1147525 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.