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.

regexp returning values into variables stored in oneVariable

Help for those learning Tcl or writing their own scripts.
Post Reply
d
dwickie
Halfop
Posts: 76
Joined: Sat Aug 21, 2004 8:53 am
Location: /pub/beer

regexp returning values into variables stored in oneVariable

Post by dwickie »

iam trying to do simple thing, there is example:

Code: Select all

regexp -all {(.*)\s(.*)} - nick rank
this will store first (.*) into $nick and second (.*) into $rank, but if i will do it this way:

Code: Select all

# because on some channels is it for example "rank nick"

set tmp "nick rank"
regexp -all {(.*)\s(.*)} - $tmp
this wont work :/ it will store first (.*) into variable ${nick rank}

i know solution is probably simple, but i cant figure it out. can someone help me? :)
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Try

Code: Select all

set tmp {nick rank}
regexp -all {(.*)\s(.*)} - [lindex $tmp 0] [lindex $tmp 1]
in this case, you just have to change the order of nick and rank in tmp.
Post Reply