On 2002.02.22, Patrick Spence <[EMAIL PROTECTED]> wrote:
> My problem is I cannot insert the \ before the & and then wrap with braces..
Why not?
> I am pulling the string to convert from a database and piping it through my
> macro routine and I have not been able to figure out how to get it to work
> right.
proc insert_macro {thestring key macro} {
regsub -all -- $key $thestring [escape_ampersands $macro] thestring
return $thestring
}
proc testmacro {} {
set html [insert_macro "(this is a test) --CONTENT-- (this is a test)" \
"--CONTENT--" "Blah Blah & & Blah Blah"]
puts $html
}
proc escape_ampersands {str} {
regsub -all -- {&} $str {\\&} str
return $str
}
testmacro
-- Dossy
--
Dossy Shiobara mail: [EMAIL PROTECTED]
Panoptic Computer Network web: http://www.panoptic.com/
"He realized the fastest way to change is to laugh at your own
folly -- then you can let go and quickly move on." (p. 70)