Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem: regsub with large exp

8 views
Skip to first unread message

iu2

unread,
Jan 10, 2007, 2:36:25 AM1/10/07
to
Hi all,
regsub ?switches? exp string subSpec ?varName?
I tried to replace some big amoung of text in a variable using regsub
with 'exp' containg the text to be replaced. I got a Windows exception
"unknown software exception". the 'exp' part was about 300000 chars. It
contained just text - numbers with scientific notation (1.234e-03) and
one '@', no regexp patterns.
Is there a known problem using regsub with a large amount of text?
Thanks

Glenn Jackman

unread,
Jan 10, 2007, 8:56:33 AM1/10/07
to

(avoiding the regsub error message)

It sounds like you're using the wrong hammer for the job. If you have a
string and a known fixed substring, you should use the [string map] command:

set string "this is the known string"
set substr "the known"
set repl "a new"
set new_string [string map [list $substr $repl] $string]

--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry

0 new messages