View Single Post
Old 08-12-2018, 10:29 AM   #3
gbm
Wizard
gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.gbm ought to be getting tired of karma fortunes by now.
 
Posts: 2,195
Karma: 8888888
Join Date: Jun 2010
Device: Kobo Clara HD,Hisence Sero 7 Pro RIP, Nook STR, jetbook lite
Quote:
Originally Posted by madagascaradam View Post
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!
I highly recommend you install Diaps Editing Toolbag plugin, will do a lot of what you want.

bernie
Attached Thumbnails
Click image for larger version

Name:	Screenshot from 2018-08-12 10-28-25.png
Views:	175
Size:	27.9 KB
ID:	165539  
gbm is offline   Reply With Quote