Find and Replace with Regex in Microsoft Word 2013

后端 未结 3 777
花落未央
花落未央 2020-12-31 02:12

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&         


        
相关标签:
3条回答
  • 2020-12-31 02:54

    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 times
    0 讨论(0)
  • 2020-12-31 03:02

    To 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
    
    0 讨论(0)
  • 2020-12-31 03:16

    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

    0 讨论(0)
提交回复
热议问题