|
set input "ShadingRate 5"
#set line "Some other text"
set rep "ShadingRate 10"
regsub {ShadingRate \d} $input $rep copy
puts $copy
|
This example assumes the user is copying a rib file
line-by-line to another file (refer to file copying)
and that
the value of a RIB statement called ShadingRate must
be changed to 10. Each line of text is processed by the
regsub proc. If regsub finds a match the variable "copy"
receives the rep'lacement text, otherwise the
variable receives an unaltered copy of the input text.
Uncomment the second line of text to confirm this
example works as stated.
|