4 ms·
This is not quite right... First off I think you want "regsub -all ...". Second, since your regsub isn't really replacing newlines (except the first), the exa
by jjnoakes 5y ago
This is not quite right...
First off I think you want "regsub -all ...".
Second, since your regsub isn't really replacing newlines (except the first), the example isn't so good - your "set foo ..." works without the multiline proc because the opening square brackets are on the same line as the commands. So this also works: jdoodle.com/ia/jnc
Third, if you do change the example so that square brackets are on their own lines, as in the original request, then your version would work (with "regsub -all") but it might strip too much - like newlines inside nested quoting. See, for example: jdoodle.com/ia/jne