在 Microsoft Word 2013 中使用正则表达式查找和替换 [英] Find and Replace with Regex in Microsoft Word 2013
问题描述
我正在编辑包含大量不必要标记的电子书文档.我在文本中有许多部分的代码与此类似:
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:
<i>Some text here</i>
我正在尝试运行正则表达式查找和替换,它将查找两个 i-tag 之间的任何短语,删除 i-tag,并将样式应用于文本.
I am trying to run a regex find and replace that will find any phrase between the two i-tags, remove the i-tags, and apply a style to the text.
这是我用来搜索的内容:
Here is what I'm using to search:
Find: (<i>)(*)(</i>)
Replace: 2
我还选择了样式 > i(斜体).这告诉我们的转换软件对文本应用斜体.如果我离开 i-tags,最终会发生的是 ScribeNet 的转换过程将它们转换为十六进制值,以便它们在电子书中显示为文字文本.凌乱.
I'm also selecting Styles > i (for italic). This tells our conversion software to apply italics to the text. If I leave the i-tags, what ends up happening is ScribeNet's conversion process converts them to hex-values so that they show up as literal text in the e-book. Messy.
当我运行这个搜索时,我没有得到任何结果.我已选中使用通配符".我错过了什么?根据 Microsoft 的帮助网站,* 用于表示任意数量或类型的字符,单个字符串应该括在括号中.
When I run this search, I get no results. I have "use wildcards" checked. What am I missing? According to Microsoft's help website, * is used to represent any number or type of characters, and individual strings are supposed to be enclosed in parentheses.
推荐答案
要搜索定义为通配符的字符,请在该字符前放置一个反斜杠 ().
*
本身匹配任何字符串,因此使用范围量词匹配(1
次或多次)
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
这篇关于在 Microsoft Word 2013 中使用正则表达式查找和替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!