On Tuesday, August 18, 2015 at 4:41:31 PM UTC+2, Christian Gollwitzer wrote:
> I'm not aware of a built-in method, but I thin you work too hard. Is it
> not sufficient to just escape the metacharacters via string map? i.e.
>
> set esc [string map {. \. ? \? ....} $from]
>
> where in the braces you map the metacharacters?
If I understand your question correctly, then the answer is yes. The switch does not touch known non-meta-characters, backslash-escapes the ones that can be handled that way, and uses ascii codes for the rest.
I can't recall exactly how the code evolved, but I think that I had the \x for all characters initially (very ugly indeed!). This seemed to be the safe side ...
The dots in your reply are exactly what I'd like to have maintained along with the RE processing code (and it might depend on the switches!).
Martin