Microsoft Word/Advanced CNTRL+H
QUESTION: I am using Word 2010. I have a txt file that has a certain section I need isolated. Here's what I mean:
PID|1||1915017||TAHAR^JULIETTE^^^^||19540916|F|||3900 TUNLAW ROAD NW^APT 314^WASHINGTON^DC^20007^^|||---|^||||999-99-9999|||^||||||||N
OBR|1||631571333389|BRECNCLT^Mammogram Recall No Charge Left||200809240001|200809240001|200809240001|||||||||||||||||S|||||||MUSK|||SHAMS|||||MUSK|200809240001
OBX|1|TX|||09/24/2008: MAMMO RECALL LEFT
OBX|2|TX|||09/24/2008: US BREAST LT
OBX|4|TX|||HISTORY: Density seen on screening mammogram in the left breast. For
I only need to remove the phrase "BRECNCLT^Mammogram Recall No Charge Left." Each line begins with either MSH, RIS, PID, OBX or OBR. I want to keep only lines beginning with OBR. That seems like something I could do with find/replace, but I have not been able to figure it out. Isolating that phrase, which always follows the format: NUMBER(karat)DESCRIPTION--and always occurs in the line beginning with OBR is my desired task.
How can I do this?
Thank you kindly,
Jonathan Haynes, St. Paul, MN
ANSWER: I guess I'm misunderstanding your question because it seems to me you could just search for "BRECNCLT^Mammogram Recall No Charge Left" and replace it with nothing. Are you saying that you want to remove the entire OBR line when this text appears, or that you want to delete this phrase only when it appears in a line beginning with OBR? Or, as I believe maybe you're saying, you want to delete it when it appears in a line beginning with MSH, RIS, PID, or OBX but preserve it when it is in a line starting with OBR?
In any of those cases, it could probably be done with wildcards, but I'd need to know exactly which it is that you're trying to do.
---------- FOLLOW-UP ----------
QUESTION: I DO need to clarify. I want to end up with _ONLY_ the lines beginning with OBR. I have several hundred pages of this code, and want a resultant list that looks like:
I'm not searching for any specific phrase, just the phrase that appears in that same spot in the line beginning with OBR. BRECNCLT^Mammogram Recall No Charge Left was a single example. Each is different, but follows the format. By the way, these are exam codes for a mammography software.
I very much appreciate your answer. I'll rate you highly.
ANSWER: Okay, I think I get it now. From the above garbage, you want to extract:
OBR BRECNCLT^Mammogram Recall No Charge Left
ditching every thing else that appears between OBR and BRECNCLT and everything that appears after "Left," but the phrase won't always be identical to that. Is that correct? Will the desired phrase always begin with BRECNCLT? Or is the number of numerals and pipes (vertical lines) always the same? Also, I'm assuming that each entity that begins with OBR, OBX, etc., is a separate paragraph (that is, that the runover lines in your display are part of the same paragraph), ending with a paragraph break (not a line break). Is that correct?
I can't guarantee that I can figure out a way to do this, even with wildcards; it may be necessary to use a macro, and if that's the case, I'll need to confer with (or refer you to) someone else!
---------- FOLLOW-UP ----------
QUESTION: You are correct. These are lines of HL7 code in the healthcare industry--the standard. BRECNCLT^Mammogram Recall No Charge Left is one example. Every one will appear in the OBR line, and yes, the number of pipes is consistent, as that defines the "segment" the desired phrase appears within. My hope is to isolate only the OBR line, but if I could, as you show above, separate just the BRECNCLT^Mammogram Recall No Charge Left (without the "OBR") into a list, that would be my ultimate goal. I researched wildcards, and realized that it was slightly above my scaffold, as it were.
I don't know about paragraph breaks as you indicate above--all I know is each is a line of text with a carriage return (?) after each. The HL7 message is in a txt file and each line can be rather long, but always begins with a heading like MSH, RIS, PID, OGBX, or OBR. This project we shall call "Parsing The OBR From HL7 Result Messages."
Your word "garbage" is a very good lay term for what you see. :-))
Okay, thanks for the follow-up. This is just to let you know I've got the message, and I will have to work on this today, perhaps consulting with a fellow Word MVP who's a wildcard guru (or at least referring to his article at http://www.gmayor.com/replace_using_wildcards.htm
What would be very helpful would be if you could send a sample of the HL7 text to me at email@example.com. Then I will be able to see how it's formatted and test on an actual sample rather than one I try to make up (which might be faulty). Then, if it's okay with you, we can pursue this further through email.