Mobileread
regex function replacement
#1  The_book 12-09-2019, 08:47 AM
Will Sigil add regex function replacement like Calibre? Or will someone design a plugin like this?
Reply 

#2  KevinH 12-09-2019, 09:16 AM
The Sigil Search and Replace has long supported regular expressions. See the Sigil User's manual.
Reply 

#3  najgori 12-09-2019, 09:48 AM
after search&replace in calibre you can compare code before and after replacement, so you can check for regex errors.
Reply 

#4  KevinH 12-09-2019, 09:52 AM
Doitsu, pointed out calibre's ability to run python code inside search and replace in regex mode. This is easy for calibre as it is written in python. Sigil's approach would be plugins.
Reply 

#5  KevinH 12-09-2019, 09:59 AM
That can not easily be done as Sigil does not use order preserving hashes for retaining attribute order (as attribute order is not significant in xhtml or xml). That type of QHash really does not exist in Qt. Hashes/dicts that retain order are built into python.

This is something on my wish list for Sigil 2.0 not 1.0. That said, a regex replacer "dry-run" sounds like it would be better as a plugin.

Quote najgori
after search&replace in calibre you can compare code before and after replacement, so you can check for regex errors.
Reply 

#6  najgori 12-09-2019, 10:45 AM
anyway, there is a lot programs that do same thing (diffchecker, textcompare...). notepad++ has compare plugin, and in my workflow really does not matter if i do it in calibre, sigil or notepad++.
thanx for fast answer.
Reply 

Today's Posts | Search this Thread | Login | Register