Thread: I need help!!!
View Single Post
Old 11-03-2010, 05:29 AM   #11
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by crutledge View Post
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>.
Jellby is offline   Reply With Quote