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.

regsub prob

Old posts that have not been replied to for several years.
Locked
j
jamesp0tter
Voice
Posts: 10
Joined: Wed Jan 29, 2003 7:23 pm

regsub prob

Post by jamesp0tter »

i've got 2 raw binds 2 get the chan topic, 332 & 333, but the topic often has chars like "[" and "]".. so it finishes up with "\]" and things like that..
so regsub to the rescue, but it keeps returming me this damn error:

[11:14] Tcl error [topic]: couldn't compile regular expression pattern: invalid escape \ sequence

what 2 do ?

i'm using -> regsub -all "\\" $tpc "" tpc <- anything wrong ? which should i use ? :|

tks in advance
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

There is no need to regsub.

The issue with the /, is usualy the cause of using Tcl lists and strings incorrectly.

The only thing I can sugest, is looking at the post in the FAQ forum, or posting the code, so we can point you in the right direction.
c
cmouse

Post by cmouse »

In lists, the use of proper list functions usually remove these pesty characthers... F.ex: if you are loading in the topic from the raw:

It comes in format
(the format is not 100% correct, but the general idea should be)
33x #chan :topic

You can use this to get the topic in correctly

set topic [split $topic ":"]
set topic [lindex $topic 1]

This should remove any pesky []...

If you want to use regexp for removing \ you need to use following escape sequence
"\\\\\\" or {\\} (not sure if i got the number \ correctly, but the amount is large...)
Locked