![]() |
#1 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Mar 2013
Device: nexus 7
|
Help! I broke my Capitalize Regex function.
Hello! Whilst trying to refine my regex for "find the first four all-caps words in a sentence, then change it to Capitalized text" I was using the regex-function Capitalize text (ignore tags). I stupidly tried to edit the code, not knowing what the heck i was doing, and now it won't perform the function (i.e. finds fo instances) or deletes those four words.
Can someone c/p the code that goes in the create/edit dialogue? I would be ever-so-grateful. |
![]() |
![]() |
![]() |
#2 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,087
Karma: 447222
Join Date: Jan 2009
Location: Valley Forge, PA, USA
Device: Kindle Paperwhite
|
This is what I got.
Code:
from calibre.utils.icu import capitalize from calibre.ebooks.oeb.polish.utils import apply_func_to_html_text def replace(match, number, file_name, metadata, dictionaries, data, functions, *args, **kwargs): '''Capitalize matched text, ignoring the text inside tag definitions.''' return apply_func_to_html_text(match, capitalize) |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 6
Karma: 10
Join Date: Mar 2013
Device: nexus 7
|
Thank you SO VERY much. I appreciate your answer!
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Help creating possible Regex-Function | MerlinMama | Editor | 14 | 03-03-2020 05:53 AM |
Predefined regex for Regex-function | sherman | Editor | 3 | 01-19-2020 05:32 AM |
regex function replacement | The_book | Sigil | 5 | 12-09-2019 09:45 AM |
regex capitalize first letter | larysa | Editor | 8 | 10-23-2017 12:04 PM |
Regex Function about «» and “” | senhal | Editor | 8 | 04-06-2016 02:12 AM |