I have several times had a text document which I need to apply several hundred find/replaces on. These find/replaces do not follow a pattern which regex can be reasonably applied to, and need to be applied in order. Previously I've resorted to doing them by hand after much searching, but is there a better way?
Please correct me if I've misunderstood your question but from your description, I take it to mean you have a single (possibly very large) Ascii
Perhaps the easiest solution would be to create file (call it
You could then run this as follows:
If you're satisfied with the output, simply
Since you would also like to consider matches that span line ends, then, yes, one way to do that is to replace all the line ends with a special character or string, do the search/replace operations you intend, then put the line ends back when you're done.
The easiest way to do the line end conversions with
If you're able to use just a single character and don't need a multicharacter string to guarantee uniqueness, you can use
Here's a screenshot how this might work.
Normally programs are good at applying a single search-and-replace combination to multiple files, not the other way around.
To me it seems like your best bet is using a word processor program with macro capabilities. Then you can write a function which performs the replacing, and then call it hundred of times with your search/replace strings. Macro-enabled word processors are, for example LibreOffice Writer and Microsoft Word.
FART should be able to help you. Just create a batch file with multiple FART calls, and if you want to replace newlines (