egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

lreplace question

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
Jag
Halfop


Joined: 19 Sep 2003
Posts: 90

PostPosted: Sun Mar 21, 2004 2:32 pm    Post subject: lreplace question Reply with quote

I have the line:
Quote:
1.2.3.4

How can i replace these lines to be:
Quote:
1*2*3*3

With the [lreplace] command?

I have read the manual of this command, but i didn't understand.
Hope that you'll help me, thanks Smile
Back to top
View user's profile Send private message
Rusher2K
Halfop


Joined: 18 Apr 2003
Posts: 88
Location: Germany

PostPosted: Sun Mar 21, 2004 3:10 pm    Post subject: Reply with quote

You can use that :
Code:
set code "1.2.3.4"

set code [string map {. *} 1.2.3.4.5] ; return $code

that returns : 2 - result: 1*2*3*4*5 - clicks: 109

Or that :
Code:
set code "1.2.3.4"

regsub -all -- {\.} $code * code ; return $code

that returns : 2 - result: 1*2*3*4*5 - clicks: 416

_________________
ISP4Player = Internet Service Provider 4 Player
German Top Hoster.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Jag
Halfop


Joined: 19 Sep 2003
Posts: 90

PostPosted: Mon Mar 22, 2004 8:28 am    Post subject: Reply with quote

Thanks, it works! Smile

last question, how can i regsub all the colors/bolds/italics (\003,\002\037) from line?

Thanks again Razz
Back to top
View user's profile Send private message
GodOfSuicide
Master


Joined: 17 Jun 2002
Posts: 463
Location: Austria

PostPosted: Mon Mar 22, 2004 9:14 am    Post subject: Reply with quote

Code:

proc stripcolors { text } {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026} $text {} text
return $text
}
Back to top
View user's profile Send private message
arcane
Master


Joined: 30 Jan 2003
Posts: 280
Location: Germany

PostPosted: Mon Mar 22, 2004 10:56 am    Post subject: Reply with quote

or another version:
Code:

set code "1.2.3.4"
set code [join [split $code .] *]

_________________
aVote page back online!
Check out the most popular voting script for eggdrop bots.

Join the metal tavern!
Back to top
View user's profile Send private message Visit poster's website
Jag
Halfop


Joined: 19 Sep 2003
Posts: 90

PostPosted: Mon Mar 22, 2004 11:25 am    Post subject: Reply with quote

Thank you all Smile
Back to top
View user's profile Send private message
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Fri Mar 26, 2004 6:25 am    Post subject: I've said this before... Reply with quote

GodOfSuicide wrote:
Code:
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026} $text {} text

That's not the right way to match colors. It would match things like "\003," "\003,99" "\00366," where "," and "99" are not part of the color "tag". Try this instead:
Code:
regsub -all {\002|\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\026|\037} $text {} text

_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber