Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Evaluation of substitutions in [regsub]

Closed / Duplicate550799ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 23 years ago
Descriptionplain2002-04-30 21:47:10
It would be nice if there was a switch to [regsub] to
make it automatically pass the strings it is
substituting through, say, Tcl_SubstObj() before
substitution. At the moment you need to perform several
stages of substitution, first hiding all significant
characters in the input string, then substituting
things (usually looking like command substitutions)
which describe what you actually want to change, and
finally passing the result through [subst] to convert
the substitutions into their actual value.  Sure this
works, but it is not a technique that is clear to
anyone other than a Tcl guru, and being able to perform
the substitution on strings as they are being replaced
by [regsub] would be much clearer (especially as it
would also allow the removal of the pre-filtering stage
as well.)

Naturally, if this was done some care would need to be
taken with ensuring that those parts derived from the
string being matched were properly quoted as well, but
this idea already exists in principle in Tk (in binding
script substitutions) so it won't be foreign to users...
hobbsplain2003-11-12 07:24:53
Logged In: YES 
user_id=72656

dup 652953
Log in (anonymous is fine) to add a comment.