devknob Posted December 8, 2009 Share Posted December 8, 2009 This works in my preg_match_all(): $gamesRegex = '#<h4>(.*?)<#i'; This doesnt work in my preg_match_all(); $gamesRegex = '#<h4>(.*?)<br clear="left">#i'; Any idea why? anything after the < is causing it not to work, which I cant understand because other preg_matches are working with < and letters afterwards. Link to comment https://forums.phpfreaks.com/topic/184379-preg_match-being-touchy-not-working-properly/ Share on other sites More sharing options...
cags Posted December 8, 2009 Share Posted December 8, 2009 What input string are you testing it with? Link to comment https://forums.phpfreaks.com/topic/184379-preg_match-being-touchy-not-working-properly/#findComment-973332 Share on other sites More sharing options...
devknob Posted December 8, 2009 Author Share Posted December 8, 2009 It was the linebreaks. just added this to the data i was trying to go through str_replace("\n", "",$page); Link to comment https://forums.phpfreaks.com/topic/184379-preg_match-being-touchy-not-working-properly/#findComment-973333 Share on other sites More sharing options...
cags Posted December 8, 2009 Share Posted December 8, 2009 The fullstop doesn't match newline characters by default, you can change this using the s modifier. $gamesRegex = '#<h4>(.*?)<br clear="left">#is'; Link to comment https://forums.phpfreaks.com/topic/184379-preg_match-being-touchy-not-working-properly/#findComment-973336 Share on other sites More sharing options...
devknob Posted December 8, 2009 Author Share Posted December 8, 2009 ah, thanks =) Link to comment https://forums.phpfreaks.com/topic/184379-preg_match-being-touchy-not-working-properly/#findComment-973338 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.