MattR Posted December 16, 2010 Share Posted December 16, 2010 Really cannot see why this doesn't work. $text = "<div id=\"page\"> <div class=\"item\"> Test </div> </div>"; preg_match("#<div id=\"page\"><div class=\"item\">(.*?)</div></div>#m", $text, &$match); var_dump($match); Output: array(0) { } Why?? Quote Link to comment Share on other sites More sharing options...
mikecampbell Posted December 16, 2010 Share Posted December 16, 2010 You aren't matching the spaces/tabs/newlines that are between your nested div tags. Quote Link to comment Share on other sites More sharing options...
requinix Posted December 16, 2010 Share Posted December 16, 2010 . will only match newlines (\r and \n) if you give the /s regex flag. Quote Link to comment 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.