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