View Single Post
Old 01-30-2023, 10:40 AM   #9
enuddleyarbl
Guru
enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.enuddleyarbl ought to be getting tired of karma fortunes by now.
 
enuddleyarbl's Avatar
 
Posts: 782
Karma: 1538394
Join Date: Sep 2013
Device: Kobo Sage
I think I understand what you're doing with that regex. The only issue is that Calibre doesn't support lower-casing via \L\E. But, I worked around that with the Calibre Editor's Regex-Funtion "Lower-case text" mode. I've got to examine the document a bit more to double-check, but it looks good. Thanks.
  • Pass 1: Removes the extraneous starting bit of the bad chapter heading
  • Pass 2: Grabs the end-of-word fragment, strips the formatting, makes it lower case with \L and \E (Calibre doesn't support that) and marks it as heading level h4
  • Pass 3: Grabs the starting character, strips the formatting and marks it as heading level h3
  • Pass 4: Grabs the end-of-word fragment at the h4 level, strips off everything else, concatenates it with the starting character at the h3 level and ends the result in an ending h3 tag
  • Pass 5: Replaces each chunk of intermediate white space (and tags) with a single space
  • Pass 6: Removes the intervening tags/whitespace/class="whitespace" stuff from between the remaining two strings and puts the second string in a span
  • Pass 7: Removes the extraneous ending bit of the bad chapter heading
enuddleyarbl is offline   Reply With Quote