I need to translate an HL7 ORU into an EDIFact message. The ORU message contains a textual result, with lots of .sk+4 or .sk+49 escape sequences. So I want to replace these .sk+n escape sequences with n spaces.
I want to this with a regsub. I’m not very fluent in regexp/regsub, but got pretty far: I can isolate the number n, but I can’t get the regsub to put in n spaces. Let me show you:
hcitcl>set a “test\.sk+5\regel”
test.sk+5regel
hcitcl>regsub -all — {\.sk+(d)\} $a {A1} b
1
hcitcl>echo $b
testA5regel
hcitcl>regsub -all — {\.sk+(d)\} $a [string repeat “A” 1] b
Error: expected integer but got “”
hcitcl>regsub -all — {\.sk+(d)\} $a [string repeat “A” \1] b
Error: expected integer but got “1”
In the end I have tried loads of combinations to get the 1 to work inside the ‘string repeat’ but no luck. Has anybody done something like this before? Or knows how to do this?
If I can’t get it to work with one regsub, I will use the regsub to replace .sk+n with something like ~n and then write some tcl code to replace all ~n with n spaces.
Thanks!
Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands