I am editing an e-book document with a lot of unnecessary markup. I have a number of sections in the text with code similar to this:
Some text here&
Search for \<i\>(*{1,})\</i\>
and replace with \1
. Don't forget to check Use wildcard
.
There is a reference table for Word's "regular expressions" here: http://office.microsoft.com/en-ca/word-help/find-and-replace-text-by-using-regular-expressions-advanced-HA102350661.aspx
<
and >
are special characters that need to be escaped*
means any character{1,}
means one or more timesTo search for a character that's defined as a wildcard, place a backslash (\
) before that character. The *
itself matches any string of characters, so use the range quantifier to match (1
or more times)
Find: \<i\>(*{1,})\</i\>
Replace: \1
There is a special tool for Microsoft Word called Multiple Find & Replace (see http://www.translatortools.net/products/transtoolsplus/word-multiplefindreplace) which allows to work around Word's wildcard limitations. This tool can use the standard regular expressions syntax to search and replace any text within a Word document. For example, to search for any HTML tags, you can just use <[^>]+> which will find opening, closing and standalone HTML tags. You can add any number of expressions to a list and then search the document for all of them, replace everything, see all matches for all the search expressions entered, replace only selected matches, and a few more things.
I created it for translators and editors, but it is great for any advanced search/replace operations in Word, and I am sure you will find it very useful.
Stanislav