Quote:
Originally Posted by KevinH
Based on the images and discussion above ... something like an AutoReplace tool or plugin that allows you to load and save a text file. The text file would be pipe delimited one entry per line with what to find first then a "|" character then the replacement text followed by a new line (or cr/lf for Windows).
|
Since most user probably maintain such list with a spreadsheet app, I'd recommend that the input files should be two-column .csv or tab-delimited files, because both can be easily exported.
Quote:
Originally Posted by KevinH
All text files would be utf-8 encoded.
|
This is a good idea, because some Windows apps still save .csv files as ANSI/CP1252 files, but most
can save UTF-8 files.
Quote:
Originally Posted by KevinH
That sounds very very doable, although it may be better as a plugin.
|
Agreed. I actually might write one over the Christmas break, if enough users are interested and KevinH isn't interested in writing it.
Quote:
Originally Posted by elibrarian
Given it is made as a plugin, wouldn't Python's regex engine be able to handle something in that direction?
|
Python actually has two regex engines (
re and
regex) and one of them even has
limited support for fuzzy searches.
Quote:
Originally Posted by elibrarian
(I would have no objections to a plugin - would the plugin implementation be significant slower than a C++ implementation in the Sigil core if working with big files/many replacements?)
|
That depends on the implementation and the number of entries in the list. A C++ implementation would definitely be faster, but a pure Python solution shouldn't be that much slower, especially, if the list isn't too long.