Regular expresion and updating the -state option.



Hello group,
I am writing a script in wish 8.3 and I am out of ideas here. I am horrible with regular expression. In the following script I want to select the "Start Logging" option from the file menu and get the following results:

{Adams Je|64@1882835} {Adams, Jo|1555@18008835} {Adams, Ra|80346@180025} {Adams, Wa|91439@180325} {Adkinson, T|1301@1882835}

Instead of:
{<OPTION VALUE="Adams Je|64@1882835">} {Adams Je|64@1882835} {<OPTION VALUE="Adams, Jo|1555@18008835">} {Adams, Jo|1555@18008835} {<OPTION VALUE="Adams, Ra|80346@180025">} {Adams, Ra|80346@180025} {<OPTION VALUE="Adams, Wa|91439@180325">} {Adams, Wa|91439@180325} {<OPTION VALUE="Adkinson, T|1301@1882835">} {Adkinson, T|1301@1882835}

I know that the -inline option is the one giving me the results including the <OPTION VALUE=""> string but how the heck do I get rid of it? Is it a better way to get the values I want (name and pin/pager # I will take the {} out later) with another regexp? There will be about 800 results and when I get double results, well, you know.

Then when I get the results the foo proc the "Start Logging" should be "disabled and the "Stop Logging" should be normal. I cannot get that behavior either. Eventually after I exit the proc the "Start Logging" and "Stop Logging" should reset back to the original state.

Any help will be appreciated.

Here is the modified script for testing purposes:

wm title . "TDP"
wm iconname . "TDP"
proc foo {} {
set foo2 0
while {$foo2 != 1} {
set data { <OPTION VALUE="Adams Je|64@1882835">Adams Je</OPTION>
<OPTION VALUE="Adams, Jo|1555@18008835">Adams, Jo</OPTION>
<OPTION VALUE="Adams, Ra|80346@180025">Adams, Ra</OPTION>
<OPTION VALUE="Adams, Wa|91439@180325">Adams, Wa</OPTION>
<OPTION VALUE="Adkinson, T|1301@1882835">Adkinson, Tim</OPTION>}
set users_list [regexp -all -inline -- {<OPTION VALUE="([^\>]*)">} $data]
puts $users_list
set stop_state normal
set start_state disable
incr foo2
} ; #end of while loop
#set stop_state disable
#set start_statenormal
} ; #end of foo proc
set stop_state disable
set start_state normal
frame .mbar -borderwidth 1 -relief raised
pack .mbar -fill x ;# packing for file/help menu. Must be at the top.
menubutton .mbar.file -text "File" -underline 0 -menu .mbar.file.m
set fm [menu .mbar.file.m -tearoff 0]
$fm add command -label "Start Logging" -state $start_state -underline 0 -command {foo}
$fm add command -label "Stop Logging" -state $stop_state -underline 0 -command {set foo2 1}
pack .mbar.file -side left


Thanks for the help folks!
Fernando
.