![]() |
#1 |
Zealot
![]() Posts: 100
Karma: 10
Join Date: Aug 2019
Device: none
|
regex function replacement
Will Sigil add regex function replacement like Calibre? Or will someone design a plugin like this?
|
![]() |
![]() |
![]() |
#2 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,048
Karma: 5449552
Join Date: Nov 2009
Device: many
|
The Sigil Search and Replace has long supported regular expressions. See the Sigil User's manual.
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Klak
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 174
Karma: 150374
Join Date: Sep 2011
Location: Belgrade, Serbia
Device: many
|
after search&replace in calibre you can compare code before and after replacement, so you can check for regex errors.
|
![]() |
![]() |
![]() |
#4 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,048
Karma: 5449552
Join Date: Nov 2009
Device: many
|
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.
|
![]() |
![]() |
![]() |
#5 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,048
Karma: 5449552
Join Date: Nov 2009
Device: many
|
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. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Klak
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 174
Karma: 150374
Join Date: Sep 2011
Location: Belgrade, Serbia
Device: many
|
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. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
RegEx Function: Title Case | phossler | Editor | 29 | 07-04-2020 10:52 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 |
Regex replacement | qsipl | General Discussions | 2 | 07-01-2014 04:28 PM |