MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Editor (https://www.mobileread.com/forums/forumdisplay.php?f=262)
-   -   Predefined regex for Regex-function (https://www.mobileread.com/forums/showthread.php?t=326679)

sherman 01-19-2020 12:34 AM

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.

kovidgoyal 01-19-2020 03:04 AM

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.

sherman 01-19-2020 05:52 AM

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?

kovidgoyal 01-19-2020 06:32 AM

yeah and look in tweak_book/search.py


All times are GMT -4. The time now is 06:58 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.