![]() |
#1 |
Junior Member
![]() Posts: 1
Karma: 10
Join Date: Jun 2015
Device: none
|
Sigil Regex Title case
Hi Everyone,
Is there a regex that can convert text into Title case in sigil? From: <h2>CHAPTER III. LEARNING THE "REGEX" AND MORE</h2> into: <h2>Chapter III. Learning the "Regex" and More</h2> I tried \L \l \U and \u but not working. What is the Regex for doing so? Thanks! |
![]() |
![]() |
![]() |
#2 |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,313
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
I don't think there is one in Sigil. The best I've come up with is <h2>\L\1\E</h2> which puts them all in lowercase, then you can do multiple cycles of <h2>(.*?) ([a-z])(.*?)</h2> to <h2>\1 \u\2\3</h2>.
It's not perfect, it will miss things like ", III, the, and unless you specifically code for them. I've found it is overall faster if you do the first step for all lowercase, then just manually highlight and use the Ab button. The better answer is to use Calibre's Book Editor. They have Regex functions that will do that built in. The BEST answer is to get one of our enterprising coders to get regex functions for Sigil... ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 860
Karma: 4097942
Join Date: Jun 2012
Location: London, UK
Device: Sony PRS-505, Pocketbook TL3, TL4, TL5
|
You could have a look at the sticky thread Regex Examples (https://www.mobileread.com/forums/sho...d.php?t=167971) in this forum.
I'm reasonably sure that there are a number of posts relating to this as I think I used this to create a saved search to change uppercase to title for a single word. Also there is an example in the saved Clips for this. |
![]() |
![]() |
![]() |
#4 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,685
Karma: 24031401
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
Find:([[:upper:]])([[:upper:]]{2,}) Replace:\1\L\2\E For more examples, see this old post. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
RegEx Function: Title Case | phossler | Editor | 29 | 07-04-2020 10:52 AM |
Is there a way to remove text from Title with regex | LadyKate | Library Management | 8 | 02-14-2014 04:12 PM |
Regex for Title Case or Sentence case? | Turtle91 | Sigil | 3 | 01-19-2013 01:36 PM |
RegEx for title - author - series? | mattam | Library Management | 10 | 08-29-2012 11:11 PM |
Sigil and Regex | crutledge | Sigil | 2 | 07-14-2010 04:51 PM |