var ss = "Is is the cost of of gasoline going up up?.\n";
var re = /\b([a-z]+) \1\b/gim; // 创建正则表达式样式。
var rv = ss.replace(re,"$1"); // 用一个单词替代两个单词。
最接近的等价 VBScript 代码如下:
Dim ss, re, rv
ss = "Is is the cost of of gasoline going up up?." & vbNewLine
Set re = New RegExp
re.Pattern = "\b([a-z]+) \1\b"
re.Global = True
re.IgnoreCase = True
re.MultiLine = True
rv = re.Replace(ss,"$1")
请注意在 VBScript 代码中,全局、大小写敏感性以及多行标记都是使用 RegExp 对象的适当属性来设置的。