I am just looking to see if anyone has any thoughts on a better way of doing this. I have a system that sends me a bunch of selected fields in a non-ordered list like this below:
2(1).1(0).0(0).OBR(0).#14(0).[0] : >Signs and Symptoms: ignore; Pacemaker: No; Aneurysm Clips: No; Implanted Defibrillator: No; Insulin Pump: No; Bullets, Shrapnel, BB’s: No; Any Hx of Metal Fragments in the eye? (welding, hobbies, job related?): No; < I need certain answers from these selected fields, sometimes all of them, sometimes just one, but they are not in the same order all the time. Also sometimes the labels and questions are completely different depending on the test coming in. Right now I am using string first to find a word (such as Aneurysm Clips: ) and then grabbing the answer (yes/no/etc) by getting what is in between the ending “;” and the end of the label word “:”. The problem with this is I have to do it for every word I want, and if two “answers” contain the word Symptoms: (as an example) – I could get the wrong value because first would obviously only get the first one even if one said Symptoms: and the other said Additional Symptoms: Not sure there is a perfect way. My setup: 1) Find the word: set location [string first “Insulin Pump:” $xlateInVals] set xlateOutVals $location 2) Grab what’s after the label word I just found: set something [crange $xlateInVals [string first “:” $xlateInVals $location] [string first “;” $xlateInVals $location]] set something [crange $something 2 end-1] set something [regsub -all ” ” $something “”] — Only because it doesn’t work if I don’t remove the spaces (see question 2) Like I said, this works fine but it seems inefficient. Any ideas? #2 Question: When I copy something with a space (exp: Clean Catch) into a variable, I can echo that variable and it shows just fine, but when I try to place that variable into another field somewhere it only ever does the first word (Clean only). Any ideas on this? Thank you in advance, Jon