Is there a way to easily code from within (La)TeX some text manipulation stuff, like "find" and "replace", so that I may automatize tedious manual labor ?
(EDIT It was mentioned in the comments by Christian Hupfer that l3regex might be a solution, covering the constraints mentioned below - although David Carlisle said "no". Which one is it ?)
There are some important constraints though:
The approach has to be general, i.e. only using macros won't work, because I may want to do things like replace all occurences of "=" with ">".
I don't want to use LuaTeX (where I have heard that this can be done easily)
Coding should ideally by done in the preamble. As indicate here this can be done easily via the
xstringpackage, but that has the disadvantage that if I want to search around the whole text (which can be quite large) I have to enclose everything in a\StrSubstitute[0]which seems an ugly approach and requires me to mess with the content of my document which I'd rather leave untouched.At the very least I should be able to do text replacement, but I'd hope for some more advanced capabilities, meaning to have available at least a subset of the capabilities, regarding text manipulation, of a linux scripting language like sed
regular expressions, from within the editor? – Bernard Apr 08 '16 at 18:20l3regex? – Apr 08 '16 at 18:20:with\colon. But the idea is for the language to be sufficiently powerful so that I keep my options open for the future and do not have to adopt a different solution, if some more complicated scenario of text replacement occurs. – l7ll7 Apr 08 '16 at 18:24\substring{\mystring}{:}{\colon}? – Steven B. Segletes Apr 08 '16 at 18:26l3regexpackage mentioned above seems to be exactly what I want, wouldn't you agree ? – l7ll7 Apr 08 '16 at 18:31:in math mode you could just redefine its \mathcode to make it work like \colon without changing the token at all. – David Carlisle Apr 08 '16 at 18:40l3regexfor something it has been not designed, Is there a reason why it won't work ? Perhaps its too slow for long documents ? – l7ll7 Apr 08 '16 at 18:45sedandawkwould be the right tools to build the substitution rules. – Steven B. Segletes Apr 08 '16 at 18:47l3regexis meant for whole documents – Apr 08 '16 at 20:23l3regex– Apr 13 '16 at 15:07