======Using Find and Replace======
Microsoft Word's Find & Replace function is a powerful feature that can be used in a variety of ways while e-text editing.
You can use it to search for words and phrases, and increase precision by using the included options (i.e., Whole word only, ignore case, etc.). You can also search for patterns of text by searching for special characters in addition to text. You can access the codes for these special characters by selecting the item from the drop-down menu in the ''Find'' tool:
{{ :public:nnels:etext:findreplace2.png?300 |}}
A few that are used often in etext reformatting are:
* ''^p'' (Paragraph marker - ¶)
* ''^l'' (Newline Break - ↵)
* ''^w'' (White/Blank Space)
* ''^$'' (Any letter)
* ''^#'' (Any digit)
* [[http://accessinghigherground.org/handouts2013/HTCTU%20Alt%20Format%20Manuals/Formatting%20with%20Word/Old%20Material/Handouts/05%20Advanced%20Find%20and%20Replace%20in%20Microsoft%20Word.pdf|More]]
Word has a lot of options to find letters (^$) and numbers (^#) when using Find & Replace, but these only work with the wildcard option //off// (which it is by default). Only turn the wildcard option on if you're using [[public:nnels:etext:regex|Regular Expression options]]. Read the info page carefully on when things apply with the wildcard option on/off.
=====Advanced Find and Replace Using Wildcards=====
You can also use wildcards for more advanced work. Learn more at the following links:
* [[https://support.office.com/en-us/article/Find-and-replace-text-and-other-data-in-a-Word-document-c6728c16-469e-43cd-afe4-7708c6c779b7?ui=en-US&rs=en-US&ad=US#__toc282774574|Using Wildcards]]: the "Use codes to find letters, formatting, fields, or special characters" is very helpful.
*[[http://wordmvp.com/FAQs/General/UsingWildcards.htm|Finding and replacing characters using wildcards in MS Word]]
=====Problems and Solutions Using Find and Replace=====
In this section you will find examples of different ways to use ''Find and Replace'' to help you with some common reformatting issues.
If you don't see the solution to your problem on this page, go to the [[public:nnels:etext:regex|Using Regular Expressions (Regex)]]. If you still can't find it, try using a wild card for find and replace, or write your own Regex.
If you discover a solution to a problem that is not on this page, please contact the Production Coordinator. They can teach you how to add your own solutions through updating this wiki page. All updates to this page //must// be shared with the full team.
----
**PROBLEM**: ALL CAPITAL LETTERS. We have to [[public:nnels:etext:capitalization|change All Caps to Sentence Case or Capitalize Each Letter]]
**SOLUTION**:
* Open ''Advanced Find & Replace'' and turn on ''wild cards''.
* Close ''Advanced Find & Replace''
* Enter ''[A-Z]{2,}'' into the search bar and it will find all the all capital words.
Note: This also finds acronyms and abbreviations, so you have to just scroll through all of the all cap instances and manually change any that are proper words and phrases into either Sentence case of Capitalize Each Word. You can also create a [[public:nnels:etext:keyboard-shortcuts|keyboard shortcut]] for change capitalization.
Here is a quick video demo: [[https://somup.com/crl6bv0541]]
----
**PROBLEM**: OCR did an imperfect job of recognizing the text, so words like "close" and "clue" have been rendered as "dose" and "due", or "13" has been rendered as "B"
**SOLUTION**: The first step to solving this is noticing it - hopefully something like this will jump out at you as you go through the text.\\
Using Find & Replace in the sidebar is a particularly good way to look for this type of error because not all instances of the word will be errors. So perform searches for words like "dose" and "due", scan through the results, and replace the erroneous instances with "close" and"clue".
Example:
{{ :public:nnels:etext:find_replace_1.png?300 |}}
Since all of the matches are listed in the sidebar, you will be able to go through each one and see which ones need fixing and which ones can be left alone.
This is not a perfect solution; it is impossible to be aware of every possible error that OCR might make from an older PDF, but it can help streamline some parts of the process. Scanning the entire text will still be necessary (like for the "13"s that become "B"s. Searching for a capital B will generally not be the best way to recognize the error, as there will likely be hundreds of Bs in the text) but using Find & Replace can help you solve some more readily searchable issues.
----
**PROBLEM**: There are newlines/line breaks (↵) instead of paragraph marks (¶).
**SOLUTION**: Find and remove all line breaks and replace with a single paragraph break.
Find: ''^m''
Replace with: ''^p''
If that doesn't work try:
Find: ''^l''
Replace with: ''^p''
In LibreOffice, replace all ''\n'' with ''\p'' to convert them to paragraphs.
----
**PROBLEM**: There are extra white/blank spaces in the document.
**SOLUTION**: Find and remove all extra spaces and replace with a single space.
Find: ''^w^w'' for double spaces ''^w^w^w'' for triple, and so on.
Replace with: ''^w'' for a single space
If that doesn't work try:
Find: ''^032^032'' for double spaces ''^032^032^032'' for triple, and so on.
Replace with: ''^032'' for a single space
----
**PROBLEM**: There are extra paragraph breaks. We want to keep the real paragraph breaks and remove the fake extra paragraph breaks.
**SOLUTION**: Use MS Word's find and replace to remove the extra paragraph breaks using special Word symbols.
Find: ''^p^p'' (you can also search for more than 2 paragraph breaks, i.e. ''^p^p^p'')
Replace with: ''^p''
----
**PROBLEM**: Running headers. Example, where the first three numbers and the three numbers after the filename is the page number:
''231(paragraph break)MacG_9781770494220_5p_all_r1.indd 231(paragraph break)10/27/14 11:56 AM(paragraph break)''
**SOLUTION**: Without using wildcards:
Find: ''^#^#^#^pMacG_9781770494220_5p_all_r1.indd ^#^#^#^p10/27/14 11:56 AM^p''
Replace with: nothing. If you're doing a paginated title, replace with page breaks.
You will need to remove one of the ^# at the beginning and after the .indd to remove it for 2 digit page numbers, and one last time for single digit page numbers. The following screenshot is an example with a 1-digit page number (see below), followed by the command used to isolate all such instances.
{{z_archive:screen_shot_2015-08-06_at_6.10.55_pm.png?300|}}
Find: ^#^pMacG_9781770494220_5p_all_r1.indd ^#^p10/27/14 11:56 AM^p
You will also need to do it with the leading ^#^p to catch the footer text that do not have any page numbers with it.
----
**PROBLEM**: After conversion, your etext document ended up with a number of section breaks throughout the text.
**SOLUTION**: Find and remove all section breaks and replace with nothing.
''Find'': ^b
''Replace'': [Leave blank]
One additional instance in which you might need to remove section breaks can be found on the [[public:nnels:etext:notes#advanced_tip|Footnotes and Endnotes page]].
----
**PROBLEM**: Need to change a style in a large text, but don't want to search page-by-page for it.
**SOLUTION**: Find and replace using the font settings in the advanced Find and Replace Box.
''Find'': select the ''Format'' dropdown menu and select the font
''Replace'': select the ''Format'' dropdown menu and select the font
For more information see [[https://www.youtube.com/watch?v=7j92Py8J3qg|this video]] for more information
----
**PROBLEM**: You need to find a specific applied style to edit.
**SOLUTION**: You can either use Find to locate a style and change it manually with the style pane, or you can use Find & Replace.
To ''Find'' a Style:
- Keep the ''Find'' box empty.
- Click on the ''More'' button if it is available.
- Click on the ''No Formatting'' button, if it is enabled.
- Click on the ''Format'' button and select ''Style''
- Select the style for which you want to search.
- Click on ''OK''.
- Click on ''Find Next''
To ''Replace'' a style:
- Same directions as above for ''Find''
- Repeat directions for ''Replace''
====== Q&A ======
**Q: I have a book that has a vast number of subheadings for each chapter, and the book itself is very long. Right now all the subheadings are set at H3, but should be H2. Is there a quick way to do this? Note: I can not delete Heading 3 Style. I am currently going through and manually changing them. I am changing the Chapters to H1 and the subheadings to H2.
**
A: You can use Advanced Find and Replace to search for all text that is styled as Heading 3 and replace that with Heading 2. Here is a screenshot of how that Find & Replace looks on my Mac:
{{:public:nnels:etext:findreplaceheadings.png?linkonly|}}
[[public:nnels:etext:start|Return to main eText Page]]