View Single Post
Old 08-12-2018, 06:49 AM   #2
madagascaradam
Enthusiast
madagascaradam began at the beginning.
 
Posts: 36
Karma: 10
Join Date: Jul 2015
Device: Kobo H2O Edition 2
OK, I did more searching in the forum and read some examples that happened to show what I needed. Putting parentheses around my expressions essentially numbers what's found within them for later reference (such as in the "replace" section):

Code:
<p class="left-bullet">(•••*)</p>
<p class="left"><strong>(.*)</strong></p>
Then, if I make my new "replace" code this, it does what I want:

Code:
<p class="left-bullet">\1</p>
<h3>\2</h3>
Then I go in and add those entries as auto-generated from "major headers" in the edit ToC section.

Now that I understand that, I went back into the RegEx FAQ and the Quick reference page to see if it was explained there... and now that I understand what it means, I can see it's referred to there. However, it certainly wasn't clear and it would be clarified a lot if an example (such as mine) were given. Actually, the real example that helped me figure it out was taken from here: https://www.mobileread.com/forums/sh...=replace+regex

The person's question and the other's response helped me see what was different about it, experiment a little, and figure it out. Still, I think more "grouping" explanation would help a LOT for those new to RegEx (like me) who are reading the FAQ. They should put an extra example in there, and talk about how surrounding your expression with parentheses makes a group of it and can be recalled later by choosing it's number in the order in which it was grouped (and give examples so they can see what you're talking about). Anyway, that's my suggestion. Just glad I found my answer because now I have several hundred entries quickly added to my ToC without manually doing it all!
madagascaradam is offline   Reply With Quote