Title: Replace everything between two points
Last modified: August 30, 2016

---

# Replace everything between two points

 *  Resolved [Lemonsprig](https://wordpress.org/support/users/lemonsprig/)
 * (@lemonsprig)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/replace-everything-between-two-points/)
 * Hi,
 * I need to be able to delete everything between two points. For example a div 
   with a specific class. The content between the div however changes.
 * If this can be done how would I go about it.
 * Thanks,
 * [https://wordpress.org/plugins/real-time-find-and-replace/](https://wordpress.org/plugins/real-time-find-and-replace/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Marios Alexandrou](https://wordpress.org/support/users/marios-alexandrou/)
 * (@marios-alexandrou)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/replace-everything-between-two-points/#post-6738276)
 * Yes this can be done. It’s actually a common use for the plugin. You need to 
   use a regex rule where the find is something like [tag](.*)?[/tag].
 * Sometimes you need a regular expression that is a little “smarter”, but I’ve 
   used the above in many places.
 *  Thread Starter [Lemonsprig](https://wordpress.org/support/users/lemonsprig/)
 * (@lemonsprig)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/replace-everything-between-two-points/#post-6738312)
 * Hi Marios,
 * thanks for letting me know it can be done. I am struggling however to get it 
   to work, and now I am getting a blank page no matter what page I visit (even 
   ones without the tags I am looking for). From the help I understand that this
   is due to incorrect regex formatting. Can you help please
 * this is what I have
 * /[<div class=”ERIngredients”>](.*)?[/<div class=”ERNutrition”></div>]/
 * So effectively I want to remove everything between
 * <div class=”ERIngredients”> and <div class=”ERNutrition”></div> ideally I would
   like to remove the actual tags themselves but I don’t know if that is possible.
 * Thanks
 * Ian
 *  Plugin Author [Marios Alexandrou](https://wordpress.org/support/users/marios-alexandrou/)
 * (@marios-alexandrou)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/replace-everything-between-two-points/#post-6738314)
 * Are you including the [ ] because I had them in my example or because they exist
   in your code? If the former, remove them.
 * Also, with regular expressions you need to have back-slash in front of every 
   forward-slash. So </div> should actually be <\/div>. This is a requirement of
   the regex syntax. Sorry I should’ve been more explicit in my initial explanation.
 * So your rule, based on what you provided, should be:
 * /<div class=”ERIngredients”>(.*)?<div class=”ERNutrition”><\/div>/
 * On my test site the above at least doesn’t result in a blank screen.
 * This will be replaced with whatever you have in the replace box. If blank, everything
   including the tags will be removed. Note that it looks like you’ll be left with
   an extra closing div tag based on what you provided.
 *  Thread Starter [Lemonsprig](https://wordpress.org/support/users/lemonsprig/)
 * (@lemonsprig)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/replace-everything-between-two-points/#post-6738315)
 * Thanks Marios,
 * That did the trick. I did include the [] from your initial post, but tried it
   both ways as I wasn’t sure. I am still trying to wrap my head around regular 
   expressions, it’s a bit confusing and some guides make it just look like a string
   of gibberish.
 * In any event, I have now achieved the desired effect. I think to achieve what
   I really want however will require an upgrade to the pro version. But I will 
   raise a separate question for that so as not to confuse this one for others who
   may have a similar issue.
 * Thanks Again
 * Ian

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Replace everything between two points’ is closed to new replies.

 * ![](https://ps.w.org/real-time-find-and-replace/assets/icon-256x256.png?rev=1347950)
 * [Real-Time Find and Replace](https://wordpress.org/plugins/real-time-find-and-replace/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/real-time-find-and-replace/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/real-time-find-and-replace/)
 * [Active Topics](https://wordpress.org/support/plugin/real-time-find-and-replace/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/real-time-find-and-replace/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/real-time-find-and-replace/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Lemonsprig](https://wordpress.org/support/users/lemonsprig/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/replace-everything-between-two-points/#post-6738315)
 * Status: resolved