tready29483 Posted November 2, 2010 Share Posted November 2, 2010 Hey everyone, I'm having some trouble with preg_match_all in a script i'm writing and I'm wondering if anyone can help. Here is my html i'm trying to find in my content <div id=rhs_block style="padding-top:5px">Random Test Data</div> And here is the PHP i'm trying to use but always return no match. if(preg_match_all("/<div\s+[^>]*?id=rhs_block.[^>]*>(.+?)<\/div>/","",$contents)) { echo 'match found'; } else { echo 'No match found'; } If anyone can spot out my problem that would be awesome because this is driving me crazy. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/217589-preg_match_all-help/ Share on other sites More sharing options...
akitchin Posted November 2, 2010 Share Posted November 2, 2010 i'm going to take a wild stab here and say that it's because you're trying to check for matches against "", an empty string... unless i'm missing something? preg_match_all Quote Link to comment https://forums.phpfreaks.com/topic/217589-preg_match_all-help/#findComment-1129624 Share on other sites More sharing options...
tready29483 Posted November 2, 2010 Author Share Posted November 2, 2010 Right you are. Thanks for being a smart ass Quote Link to comment https://forums.phpfreaks.com/topic/217589-preg_match_all-help/#findComment-1129626 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.