View Single Post
Old 03-01-2020, 11:13 AM   #6
MerlinMama
Evangelist
MerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beautyMerlinMama does all things with Zen-like beauty
 
MerlinMama's Avatar
 
Posts: 498
Karma: 32554
Join Date: May 2014
Location: Canada
Device: Kobo Sage
I think I am misunderstanding you. From what I understand, your suggestions would remove the <em></em> tags, regardless if they are found between the <form></form> tags, which is NOT what I want. Anything outside the <form></form> tags should stay as is. The <form> tag contains formatting which has italics in it, so the addition of <em> tags are unnecessary.

I'll insert another, maybe better, example for you to comment on so I can understand. Although I'm starting to think it can't be done, or I'm just missing something obvious.

I'll mark tags I want to keep in blue, tags I don't want to keep in red (only those I'm asking about; <p> tags I won't touch.)

Spoiler:

<p>What if he was <em>right outside</em> the door? What if he came back into the room?</p>

<p class="centered">oOOo</p>

<form>
<p><em>The creature crept around the room, either missing or ignoring the small boy huddled beneath the covers on the bed. His regular blankets were placed normally, while Kevin was wrapped in the ratty black blanket he found in the treehouse in the woods.</em></p>
<p><em>He watched as the large form ambled to the door and slipped out, allowing the door to ease shut behind it. Kevin had </em>never<em> felt so relieved in his short life.</em></p>
</form>

<p class="centered">oOOo</p>

<p><em>He felt a tear slip from his eye as he came out of the memory. </em></p>

<p class="centered">oOOo</p>

<form>
<p><em>"You'd best go right to sleep, Kevin," Nana scolded. "If you don't, the Great Wolf will come in and eat us all up."</em></p>
<p><em>Poppy frowned. "Don't scare the boy, you old crone." He ushered her out and shut the door behind them.</em>
<p><em>Nana was so silly, there was no such thing as a Great Wolf that ate people, Daddy said so, Kevin thought.</em>
</form>

<p class="centered">oOOo</p>

I don't mind doing multiple passes, but as it is, I haven't been able to do anything except check each one almost individually. That's why I though that creating a Regex-Function was the way to go.

Ideally, I had hoped to be able to have something that says: "change <p><em></em></p> to just <p></p> when between <form></form> tags". I wouldn't even mind if it was "remove all <em></em> tags when between <form></form> tags".
MerlinMama is offline   Reply With Quote