ultrus Posted October 7, 2011 Share Posted October 7, 2011 Now that I've let it out.... I'm using Dreamweaver, which can make use of regular expressions just like php, to clean up a ton of static archived pages. I want to select content between <div id="admin-menu"> and the next </div> that will be replaced with nothing in my find and replace box. I have to use regex because the content between those tags change from page to page, no other divs though in between so that might help. Any thoughts? This stuff makes my head hurt. Best regards, Chris EDIT: Here's a start, selects any div, contents, closing div (I'm fine if I select the div along with the content). Now I just need to add the ' id="admin-menu"' bit so that I don't select just any content... <div\b[^>]*>(.*?)</div> Quote Link to comment https://forums.phpfreaks.com/topic/248651-ahhhh-removing-everything-between/ Share on other sites More sharing options...
silkfire Posted October 7, 2011 Share Posted October 7, 2011 You need a DOM parser. Regex wouldn't know how to find the matching DIV if there are DIVs inside your HTML code (which I'm sure there is) Quote Link to comment https://forums.phpfreaks.com/topic/248651-ahhhh-removing-everything-between/#findComment-1277054 Share on other sites More sharing options...
ultrus Posted October 7, 2011 Author Share Posted October 7, 2011 There's other divs, but not other divs with the id of "admin-menu", and no other divs inside of that, just a giant unordered list with links. I'm getting close to a solution. Any other thoughts before I beat you to the solution? Quote Link to comment https://forums.phpfreaks.com/topic/248651-ahhhh-removing-everything-between/#findComment-1277058 Share on other sites More sharing options...
ultrus Posted October 7, 2011 Author Share Posted October 7, 2011 Ok, maybe your right. I put some good practice in and came up with the same results. Thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/248651-ahhhh-removing-everything-between/#findComment-1277064 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.