01-18-2020, 11:34 PM | #1 |
Guru
Posts: 869
Karma: 2676800
Join Date: Aug 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. |
01-19-2020, 02:04 AM | #2 |
creator of calibre
Posts: 44,428
Karma: 24044628
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 02:31 AM. |
Advert | |
|
01-19-2020, 04:52 AM | #3 |
Guru
Posts: 869
Karma: 2676800
Join Date: Aug 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? |
01-19-2020, 05:32 AM | #4 |
creator of calibre
Posts: 44,428
Karma: 24044628
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 10:52 AM |
regex function replacement | The_book | Sigil | 5 | 12-09-2019 09:45 AM |
Random number in Regex Function? | nqk | Editor | 2 | 05-23-2017 11:47 PM |
RegEx-Function and hyphenation problem | scratch | Editor | 4 | 01-28-2017 12:44 PM |
Regex Function about «» and “” | senhal | Editor | 8 | 04-06-2016 02:12 AM |