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:

MSH|^~\&|Imagecast RIS|DC1145|MEDITECH||20121205084315||ORU^R01|13999951|P|2.3|||||||FINAL
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
OBX|5|TX|||further evaluation.  

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:

OBR||blah blah
OBR||blahty blah

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

What would be very helpful would be if you could send a sample of the HL7 text to me at 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.
About Microsoft Word
This topic answers questions related to Microsoft Word stand-alone or Microsoft Office Word including Word 2003, Word 2007, Office 2000, and Office XP. You can get Word help on formatting text, tables, tabs, fonts, styles, general Word layouts, bullets, headings, and outlines, using templates, toolbar modifications, and using Track Changes. You may also find tips on linking Word and Excel embedded objects including charts. This site does not provide a general Word tutorial nor the basics of using a word processor. It provides specific answers to using Microsoft Word only. If you do not see your Word question answered in this area then please ask a Word question here

Microsoft Word

All Answers

Answers by Expert:

Ask Experts


Suzanne S. Barnhill


I've been using Word for Windows since version 2.0 (1992), and the more I learn about it, the more I realize how little I know. But I may know a few things that you don't, and I'll help if I can. I answer many questions every day in Microsoft's peer support forums and as a result have been awarded the MVP (Most Valuable Professional) designation by Microsoft Corporation. You may be able to find the answer to your question at the Word MVPs' FAQ site or at my own Word FAQ site, so please check those first! Please, no questions about VBA (macros), Registry editing, networks, or complex merges, as I have no experience with these aspects of Word, nor do I have any experience with Word for Mac. Please indicate which version of Word you are using; if you are not sure, see "What version of Word do I have?".


I have a master's degree in classics (Latin), which is surprisingly helpful, though I no longer teach. The things I am proudest of: Having raised two children to maturity, both Merit Scholars, both college graduates (one a philosophy major!), one Phi Beta Kappa (from Harvard!); having been made a Paul Harris Fellow by my Rotary club; having been designated a Microsoft MVP.

Rotary Club of Fairhope, Friends of the Fairhope Public Library

B.A. (Latin), Agnes Scott College, 1966; M.A. (Classics), Emory University, 1972.

Awards and Honors
Microsoft Most Valuable Professional award every year since 1999; many Rotary honors

©2017 All rights reserved.