This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

regsubing $s

Help for those learning Tcl or writing their own scripts.
Post Reply
l
llama
Voice
Posts: 3
Joined: Thu Feb 09, 2006 2:10 pm

regsubing $s

Post by llama »

I've made a quote script but I'm having a little trouble with it. If someone does the trigger to show a quote, and the quote has a $ in it, I get an error... say if the line was "blah blah $700 blah blah" ... it would error out on the partyline with "[12:08] can't read "700": no such variable" .. I've tried regsub -all {$} line "\\\$" line .. and I've tried regsub -all {\$} line "\\\$" line, but neither seem to work.. anyone have any suggestions?
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

I don't think you need regsub, you probably have a string/list issue in your script. Or the quote has been added inside the Tcl script without skipping $.
l
llama
Voice
Posts: 3
Joined: Thu Feb 09, 2006 2:10 pm

Post by llama »

Its read to a list so I can lindex the author/date added.. I didn't think that would cause a problem but apparently it does.. should I string map it instead?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

set list {
 "bla bla $blo bli bla"
 "foo $bar fee moo"
}

# and use:

foreach bla $list {
 # using $bla will work perfectly
}
l
llama
Voice
Posts: 3
Joined: Thu Feb 09, 2006 2:10 pm

Post by llama »

I'll try it, thanks !
Post Reply