MySQL_Narb Posted January 29, 2013 Share Posted January 29, 2013 (edited) <div id="playerskills" align="center"> Personal scores for <br /><br /> <table> <tr> <td>Skill</td> <td>Rank</td> <td>Level</td> <td>XP</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> <tr> <td>Not Ranked</td> <td>-</td> <td>-</td> </tr> </table> </div> Do you guys have any idea as to why the following REGEX does not pickup the above code? ~<div id="playerskills" align="center">((.|\n)+?)</div>~m It works fine when the content between the divs is on one single line; however, with the HTML I provided, it tends to break due to the multiple lines. Any ideas? Thanks. Using http://gskinner.com/RegExr/ to test. Edited January 29, 2013 by MySQL_Narb Quote Link to comment https://forums.phpfreaks.com/topic/273809-everything-between-the-tags/ Share on other sites More sharing options...
requinix Posted January 30, 2013 Share Posted January 30, 2013 The newlines in the source might be \r\ns. ~<div id="playerskills" align="center">(.+?)</div>~s (/s is the one where dot-all matches newlines, /m is the one where ^ and $ can match the beginning and end of lines) But like I said in your other thread, DOMDocument is much better for this than a regex. Quote Link to comment https://forums.phpfreaks.com/topic/273809-everything-between-the-tags/#findComment-1409068 Share on other sites More sharing options...
MySQL_Narb Posted January 30, 2013 Author Share Posted January 30, 2013 The newlines in the source might be \r\ns. ~<div id="playerskills" align="center">(.+?)</div>~s (/s is the one where dot-all matches newlines, /m is the one where ^ and $ can match the beginning and end of lines) But like I said in your other thread, DOMDocument is much better for this than a regex. Thank you. I was personally avoiding DOMDocument until I could spend some time to familiarize myself with it; however, I'll be sure to check it out once I finish my current project. I appreciate the help. Quote Link to comment https://forums.phpfreaks.com/topic/273809-everything-between-the-tags/#findComment-1409072 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.