在Microsoft Word Vba中将正则表达式转换为Regex [英] Conversion of Regex to Regex in Microsoft word Vba
问题描述
我的字符串像500 - 400,我想转换成500-400。
我的发现REGEX是
\ b( \ + +)\- - \((\ + +)\ b
我的替换替换REGEX是
\b(\d +) - ( \\\ +)\ b
如果我有默认的替换字符串,那么我将更容易替换,但在这里我有动态替换
字符串,取决于给定的值,所以我在这里构造。
建议我解决这个问题。
提前致谢
将替换字符串更改为:
< pre lang =text>
1 -
2将整个匹配的输入替换为第一组(括号中的第一个数据)后跟连字符,然后是第二个匹配组。
如果要使用正则表达式,则获取Express o [ ^ ] - 它是免费的,它会检查并生成正则表达式。
My string like 500 - 400, i want convert into 500-400.
My find REGEX is
\b(\d+)\s-\s(\d+)\b
and my replace replace REGEX is
\b(\d+)-(\d+)\b
If i have default Replace string then i will Replace easier,but here i have dynamic Replace
string that is,depends upon given values so i struct here.
Suggest me to solve this.
Thanks in advance
Change your replace string to:
1-
2That replaces the whole matched input with the first group (the first data in brackets) followed by a hyphen, then the second match group.
If you are going to use regexes, then get a copy of Expresso [^] - it's free, and it examines and generates Regular expressions.
这篇关于在Microsoft Word Vba中将正则表达式转换为Regex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!