View Single Post
Old 10-07-2024, 12:48 PM   #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
Regex: match opening div?

Is there a way using regex to match an opening and closing div?

For example, you have "<div class="whatever"> that you'd like to delete, along with the closing </div>, but there are other divs before this one's closing </div> (i.e., nested divs). <div class="whatever">(*.?)</div> will find the targeted opening div, but will match the first closing </div> it finds rather than the one associated with the opening.

You could deal with this by using Diaps toolbox, but I'm curious if there's a way to do it with pure regex?
foosion is offline   Reply With Quote