How can i replace these lines to be:1.2.3.4
With the [lreplace] command?1*2*3*3
I have read the manual of this command, but i didn't understand.
Hope that you'll help me, thanks
How can i replace these lines to be:1.2.3.4
With the [lreplace] command?1*2*3*3
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
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: 416Code: Select all
proc stripcolors { text } {
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026} $text {} text
return $text
}
Code: Select all
set code "1.2.3.4"
set code [join [split $code .] *]
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:GodOfSuicide wrote:Code: Select all
regsub -all -- {\003[0-9]{0,2}(,[0-9]{0,2})?|\017|\037|\002|\026} $text {} text
Code: Select all
regsub -all {\002|\003([0-9]{1,2}(,[0-9]{1,2})?)?|\017|\026|\037} $text {} text