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.

Getting rid of ^b etc

Old posts that have not been replied to for several years.
Locked
G
Guest

Post by Guest »

I have script that gets a nick from services and in this case the nick is bolded. How can I get rid of the damn ^b? I'm starting to go insane here.
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

The quickest method is to use regsub

If the nick with the bold taks is in the var $str

Code: Select all

regsub -all -- {[1code]
regsub -all -- {03[0-9]{0,2}(,[0-9]{0,2})?|17|37|02|26} $str "" str
[/code1]03[0-9]{0,2}(,[0-9]{0,2})?|17|37|[1code]
regsub -all -- {03[0-9]{0,2}(,[0-9]{0,2})?|17|37|02|26} $str "" str
[/code1]02|26} $str "" str
$str would now have the bold tags filtered. This will also filter out any other CTRL tags used in IRC (EG color, reverse, underline, normal)

example use

Code: Select all

bind pub - "!test" test:bind
proc test:bind {nick uh hand chan str} {
  regsub -all -- {[1code]
bind pub - "!test" test:bind
proc test:bind {nick uh hand chan str} {
  regsub -all -- {03[0-9]{0,2}(,[0-9]{0,2})?|17|37|02|26} $str "" str
  blah blah
}
[/code1]03[0-9]{0,2}(,[0-9]{0,2})?|17|37|[1code]
bind pub - "!test" test:bind
proc test:bind {nick uh hand chan str} {
  regsub -all -- {03[0-9]{0,2}(,[0-9]{0,2})?|17|37|02|26} $str "" str
  blah blah
}
[/code1]02|26} $str "" str
  blah blah
}
In the above example, all CTRL tags are removed from the test line sent to the bot.
Locked