View Single Post
Old 12-04-2021, 09:24 PM   #1
Karellen
Wizard
Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.Karellen ought to be getting tired of karma fortunes by now.
 
Karellen's Avatar
 
Posts: 1,622
Karma: 9500498
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
Regex to convert to Uppercase

Hi,

I am using the Calibre book editor and I am trying to convert the first letter of the chapter headings from lowercase to uppercase.

My search regex is...
PHP Code:
<class="calibre_3" id=".*?"><span class="calibre2"><span class="bold">(\w)(.*?)</span></span></p
My replace regex is...
PHP Code:
<h2>\U\1\E\2</h2
But I keep getting the following error message...
calibre, version 5.32.0
Spoiler:
ERROR: Unhandled exception: <b>error</b>:incomplete escape \U at position 7

calibre 5.32 embedded-python: True is64bit: False
Windows-10-10.0.19041 Windows ('32bit', 'WindowsPE')
32bit process running on 64bit windows
('Windows', '10', '10.0.19041')
Python 3.8.5
Windows: ('10', '10.0.19041', '', 'Multiprocessor Free')
Interface language: None
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (1, 45, 0) && Package KFX (from KFX Input) (1, 45, 0) && EpubCheck (0, 2, 3) && KFX metadata reader (from KFX Input) (1, 45, 0) && KFX Input (1, 45, 0) && Set KFX metadata (from KFX Output) (1, 57, 0) && KFX Output (1, 57, 0) && Kindle Collections (1, 7, 29) && && Kobo Utilities (2, 14, 1) && Manage Series (1, 2, 11) && ScrambleEbook (0, 4, 5)
Traceback (most recent call last):
File "calibre\gui2\tweak_book\boss.py", line 1114, in search
File "calibre\gui2\tweak_book\search.py", line 1561, in run_search
File "calibre\gui2\tweak_book\search.py", line 1468, in do_replace
File "calibre\gui2\tweak_book\editor\widget.py", line 329, in replace
File "calibre\gui2\tweak_book\editor\text.py", line 598, in replace
File "regex\regex.py", line 684, in _compile_replacement_helper
File "regex\_regex_core.py", line 1690, in _compile_replacement
File "regex\_regex_core.py", line 1757, in parse_repl_hex_escape



I can't see where I am going wrong. Does anybody know?

Thanks
Karellen is offline   Reply With Quote