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.
Old posts that have not been replied to for several years.
Jag
Halfop
Posts: 90 Joined: Fri Sep 19, 2003 10:06 am
Post
by Jag » Sun Mar 21, 2004 2:32 pm
I have the line:
1.2.3.4
How can i replace these lines to be:
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
Rusher2K
Halfop
Posts: 88 Joined: Fri Apr 18, 2003 10:45 am
Location: Germany
Contact:
Post
by Rusher2K » Sun Mar 21, 2004 3:10 pm
You can use that :
Code: Select all
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: Select all
set code "1.2.3.4"
regsub -all -- {\.} $code * code ; return $code
that returns : 2 - result: 1*2*3*4*5 - clicks: 416
Jag
Halfop
Posts: 90 Joined: Fri Sep 19, 2003 10:06 am
Post
by Jag » Mon Mar 22, 2004 8:28 am
Thanks, it works!
last question, how can i regsub all the colors/bolds/italics (\003,\002\037) from line?
Thanks again
GodOfSuicide
Master
Posts: 463 Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria
Post
by GodOfSuicide » Mon Mar 22, 2004 9:14 am
Code: Select all
proc stripcolors { text } {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026} $text {} text
return $text
}
arcane
Master
Posts: 280 Joined: Thu Jan 30, 2003 9:18 am
Location: Germany
Contact:
Post
by arcane » Mon Mar 22, 2004 10:56 am
or another version:
Code: Select all
set code "1.2.3.4"
set code [join [split $code .] *]
Jag
Halfop
Posts: 90 Joined: Fri Sep 19, 2003 10:06 am
Post
by Jag » Mon Mar 22, 2004 11:25 am
Thank you all
user
Posts: 1452 Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway
Post
by user » Fri Mar 26, 2004 6:25 am
GodOfSuicide wrote: Code: Select all
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: Select all
regsub -all {\002|\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\026|\037} $text {} text
Have you ever read "The Manual"?