Using code to implement a simple replacement

  
Entering one or two simple code in the Find Replacement window to implement a lookup replacement is often much more convenient than a layer selection menu. Although some special characters and format replacement menu commands are provided in Word's Find Replacement window, it is not easy to operate. You need to click a multiple menu command or button to construct a condition. As a rule of thumb, remembering some common replacement code, the search and replace by directly entering a simple code is much more convenient than picking the picking construction conditions in the menu. Case: During the process of writing words into batches, I hope to insert a small icon in front of some key paragraphs. However, because there are more paragraphs to be inserted, it is more troublesome to solve the problem by copying and pasting each time. Instead of replacing the image with a special string (for example, enter 888) (Figure 1), after the final entry is completed, replace 888 with that icon. How to achieve it? First, insert the image before the first paragraph, then click on the image and use the Ctrl+C shortcut to copy the image to the clipboard. Use Ctrl+H to start the “Find and Replace” window, click the “Replace” tab, enter the content to be checked in the “Find Content” box, and enter ^c in the “Replace with” box. (The corresponding traditional method is to click “replace “advanced →special characters →clipboard content”) (Figure 2). After that, click “all replace”, then all the 888 contents are copied to the clipboard and replaced with pictures, and the pictures in the entire layout need to be pictures (Figure 3). Case: The text space is deleted once and the article is copied from the web page into Word. The original paragraph showing good paragraphs may have more blank lines, which is difficult to read. For the blank lines in the article, manual deletion is a very troublesome thing. In fact, the essence of the blank line is that multiple "paragraph marks" are connected together, so we can use the word replacement function to delete the empty space in the article. Row. In the "Find and Replace & Rarr; Replace" dialog box, position the cursor in the "Find Content" box, type ^p^p, type ^p in the "Replace with" box, and press “ All replace & rdquo; button, you can delete a single line of blank lines. For multiple lines of blank lines, press the “Replace All” button multiple times to repeat the replacement until all empty actions are removed (Figure 4). Case: Forced to break a connection Once a novel or article copied from the Internet is pasted into a Word document, sometimes you will find that each line has a hard return when it should not be changed, and it is uneven and looks uncomfortable. How to quickly delete these hard returns? First, use the copy and paste method to add a special mark such as 999999999 in the end of the real segment of each paragraph, then open the "Find and Replace" dialog box, switch to the "Replace" tab, at &ldquo In the Find Contents box, type ^p, “replace with ” in the box, type ^s, then click the “all replace” button, and all hard returns are gone (Figure 5). Finally, type 999999999 in the “Find Content” box, enter ^p in the “Replace with” box, and click the “Replace All” button to add a paragraph end marker to the natural section of the full text (Figure 6). After the above operation, the entire paragraph "hard wounds" was "all" "healing" success. Case: Deleting footnotes or endnotes in Word One time, the footnotes and endnotes in the Word function allows us to easily add comments to the article, but it is a bit of a hassle to remove the added comments. Its practical replacement feature is easy to implement. Open the “Find and Replace” dialog box, switch to the “Replace” tab, and type ^e (for the endnote) or ^f (for the footnote) in the “Find Content” box, in “ Replace with ” do not enter anything in the input box, and then click the <; replace all & rdquo; button, you can delete the footnote or endnote added in the text.  
Copyright © Windows knowledge All Rights Reserved