View Single Post
Old 11-03-2023, 05:47 AM   #18
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Bozana View Post
I've tried everything above... I need to have a search and replace uppercases in the beggining of a paragrahs. Example:

<p class=subsq">SARAH SNUGGLED DEEPER into Kade’s embrace.</p>

And I need it to be:

<p class=subsq">Sarah snuggled deeper to Kade’s embrace</p>
For your very specific case, if you know you always have the first few words ALL CAPS in your book...

You could do something like:

Find: <p class="subsq">([A-Z])([A-Z’ ]{2,})
Replace: <p class="subsq">\1\L\2

This would find:
  • Grab the very first capital letter.
    • Assign to Group 1.
  • Grab all the other capital letters + apostrophes + spaces.
    • Assign to Group 2.

And then replace:
  • The very first letter as is.
  • Lowercase all the rest of the letters and shove them in.

But I would be very careful with this type of stuff, which is why I do a case-by-case basis replace.

There are TONS of capitalization exceptions that can occur, like:
  • First/Last Names
    • Sarah, Kade
  • Roman Numerals
    • King Charles VII
  • Acronyms
    • DNA, FBI, CIA
  • [...]

so you can't just "lowercase everything".

Since this ol' 2014 post, I've since explained and cover tons of ALL CAPS -> Smallcaps + Title Casing stuff:

If you type this into your favorite search engine:

Code:
smallcaps Tex2002ans site:mobileread.com
or:

Code:
acronyms Tex2002ans site:mobileread.com
you can find lots of previous discussion.

Quote:
Originally Posted by Bozana View Post
But realised that this works best in Sigil and not Calibre. And this this needs to work in Calibre please. Any help and suggestions would be appricated.
Yes, like Doitsu said...

In Calibre, there is a "Regex-Function" Mode now:

There is already a built-in "Lower-case" one.

And, in Sigil, there is now a much more powerful, bleeding-edge, List-Based Search/Replace.

I brainstormed a much faster ALLCAPS-><span class="smallcaps">Smallcaps</span> workflow back in:

but I have yet to write a tutorial on it.

(There have been lots of enhancements in the past 9 years since this original post!!!)

Last edited by Tex2002ans; 11-03-2023 at 10:32 PM.
Tex2002ans is offline   Reply With Quote