View Single Post
Old 12-07-2024, 10:13 AM   #1
foosion
Evangelist
foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.foosion is an enigma wrapped up in a mystery.
 
Posts: 479
Karma: 41524
Join Date: Sep 2011
Device: Kobo Libra 2 & Clara BW
Replace <br/> in <h1>...<h1/>

I'd like to replace <br/>s with a space when they're between opening and closing h1 tags. However, something simple such as

Code:
<h1>(.*?)<br/>(.*?)<h1/>
<h1>\1 \2<h1/>
doesn't work well since there are some opening and closing h1s that don't have a br between them, so this matches everything until the next br and then closing h1, which could be a lot. I just want to replace a br when it's between an opening and closing h1. In other words find an opening and closing h1 tag, then if there's a br in that range replace it with a space, otherwise do nothing.

How to?

Last edited by foosion; 12-07-2024 at 11:10 AM. Reason: Should have posted <br/> not <br>
foosion is offline   Reply With Quote