View Single Post
Old 03-01-2020, 07:32 AM   #1
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
Help creating possible Regex-Function

**If this shouldn't be here, please move or delete, and you have my apologies**



I have been trying to understand Python to create my own regex-functions, but even after a year, I'm clueless. I hope that someone can help me create one...or tell me if what I want is even possible.

I have a very long, created text, where the author included a lot of sections where each paragraph is wrapped in tags for italics. That's fine. But they also wrapped all the sections in a tag which automatically makes those paragraphs italic.

I have been trying regular search and replace expressions, but I can't get anything that works whether there is one paragraph or eight paragraphs to remove the italics tags from. It's either too greedy, or not greedy enough.

I would like help to do the following:
  1. select and mark all text between the two tags <form></form>
  2. delete the italics tags from the beginnings and endings of each paragraph
  3. if possible (probably not, but...), change the italics tags INSIDE each paragraph to bold tags

In any case, I'd appreciate being directed to an online tutorial type of place that would be easy enough for me to understand (maybe easier than "Python for Dummies" at the rate I'm going ) so I can eventually learn to do it myself.

If someone would prefer to help off-forum - messages - I don't mind that either.
MerlinMama is offline   Reply With Quote