Re: Tcl question



On Jun 29, 11:27 am, vijayaganesh...@xxxxxxxxx wrote:
 I am new to TCL and i have project to do in TCL.

when there are mutilple OBR segments in a result messgae. I need to
take OBR-2 from all segments and then send them in reverse to the
output system in TX-14 field (MDM message as Output)

Example:-- OBR|1|475678
                 OBR|2|475679
                 OBR|3|475677
                ------ as input ------------------------------------

This is as output

                 TXA|475677~475679~475678|

Thanks in advance

Chris

this will do it:
foreach {match data} [regexp -all -inline {OBR\|[0-9]\|([0-9]*)}
$input] {
lappend result $data
}
set result "TXA|[join [lreverse $result] ~]|"

of course the regexp should be fixed to be exactly as all variations
of input.
.