Quote:
Originally Posted by crutledge
Please remember that there are many <p>...</p> that are not part of the stanza. What you describe would change every <p>...</p> in the file. The changes must be limited to those <p>...</p> between <div class="stanza"> and </div>
|
Actually, the first solution only replaces <p>...</p> which are preceded by spaces.
The second was intended to find only <p>...</p> inside stanzas, but was flawed. In the "whatever" you'd have to include the restriction "does not contain '</div>'", since that restriction in often hard to express in regexp, I sometimes use this trick:
1 Replace "<div class="stanza">...</div>" with "¬...|" (¬ and | are unused characters in the rest of the file)
2 Find and replace "¬...<p>...</p>...|" where the "..." includes "[^|]", i.e., any character but |, this keeps the matching inside the ¬...| block.
3 Convert ¬ and | back into the <div class="stanza"> and </div>.