|
|
#1 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 877
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
|
Predefined regex for Regex-function
If it doesn't already exist, would it be possible for regex functions to have a predefined rexep that populates the "Find:" field?
I find that the regex-functions I create need to be called with the correct regexp to work. Currently I store it as a comment in the function source, but that gets a bit tedious after a while. |
|
|
|
|
|
#2 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609
Karma: 28549044
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
doesn't already exist and while i have no problem with this, its not something I want to spend my time on either, so patches are welcome!
And note that saved searches allow you to combine search and replace expressions/functions. Last edited by kovidgoyal; 01-19-2020 at 03:31 AM. |
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 877
Karma: 2676800
Join Date: Sep 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
|
Thanks for the reply. If I can figure out how it all works, I might try and submit a PR some time.
Basically, would need to figure out how to obtain a variable, or run a function and update the "Find" field. I'm assuming the place to start would be src/calibre/gui2/tweak_book/function_replace.py? |
|
|
|
|
|
#4 |
|
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,609
Karma: 28549044
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
yeah and look in tweak_book/search.py
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| RegEx Function: Title Case | phossler | Editor | 29 | 07-04-2020 11:52 AM |
| regex function replacement | The_book | Sigil | 5 | 12-09-2019 10:45 AM |
| Random number in Regex Function? | nqk | Editor | 2 | 05-24-2017 12:47 AM |
| RegEx-Function and hyphenation problem | scratch | Editor | 4 | 01-28-2017 01:44 PM |
| Regex Function about «» and “” | senhal | Editor | 8 | 04-06-2016 03:12 AM |