I would like to "Find and Replace" entire lines in Microsoft Office Word 2010 which match some criteria.
I tried to find the solution in the official documentation, but I didn't find the answer:
- Find and replace text by using regular expressions (Advanced)
- Add power to Word searches with regular expressions
(btw. here are two more useful unofficial documents: Find and Replace using wildcards; Regular Expressions in Microsoft Word)
Example
For example: I would like to search for all the lines which have the "Heading 2" style, and replace them so that they get between ##
symbols: so this is the original text: This is my title
, and I would like to find it and replace it this way: ## This is my title ##
(this way I could transform a text's title into a Wiki-compatible heading 2 without any external plugins (EDIT: sorry, in the meantime I realized the MediaWiki-compatible heading 2 style uses ==
instead of ##
, but it doesn't change the main point)).
So after Ctrl+H, checking "Use wildcards", selecting Format > Style > Heading 2, I've tried this and it did NOT work: (*^13>)
or (<*^13>)
, where ^13
matches "Paragraph break / 'carriage' return" (see this) - this made Word search madly, and the GUI got frozen for minutes (!). At the end, it didn't find anything (but I DO have texts with Heading 2 style).
OK, this is not the appropriate pattern, so what would be the appropriate way to search and replace entire lines in Word?