Deleting varying text between two fixed tags

A place to try and solve your RegEx problems.
Post Reply
regex
Posts: 2
Joined: Thu Mar 30, 2017 2:19 am

Deleting varying text between two fixed tags

Post by regex »

Hi,

I have this on one line:
<h3>South-West High</h3>

I want to keep the h3 tags, and replace the text between them, with:
Summer Clases. The text varies per file as the schools have different names.

I tried searching this forum and found something that's the opposite.

I also want to know how to replace between two tags or phrases which are multiline.

What do I search/find, and what do I replace - in terms of the regex code as I am a noob.

Thanks
User avatar
DigitalVolcano
Site Admin
Posts: 1717
Joined: Thu Jun 09, 2011 10:04 am

Re: Deleting varying text between two fixed tags

Post by DigitalVolcano »

You can replacing the heading tags like this:

RegEx

Code: Select all

<h3>.*?</h3>
Replace

Code: Select all

<h3>New Text</h3>
If you checkmark the option 'Dot matches newline' then the H3 tag to be replaced can span multiple lines.
regex
Posts: 2
Joined: Thu Mar 30, 2017 2:19 am

Re: Deleting varying text between two fixed tags

Post by regex »

Thank you very much.

It works perfectly.

Have an awesome weekend. :)
Post Reply