.net的vbscript语法是什么:
\b[a-z]+\b
你好
尝试替换源代码中的所有字母单词。
.net正则表达式测试仪确认此模式将找到所有单词:
\b[a-z]+\b
这:
结果,行动
返回:
发现
动作
http://regexlib.com/RETester.aspx
但是,在带有vbscript对象的excel vba中,它失败了:
Sub test()
Dim re As New VBScript_RegExp_55.RegExp
re.Global = True
re.Pattern = "\b[a-z]+\b"
Debug.Print re.Replace("Findings, Actions", "xyz")
Set re = Nothing
End Sub
'输出与输入相同-不会发生替换
Sub test()
Dim RE As Object
Set RE = CreateObject("VBScript.RegExp")
RE.ignoreCase = True
RE.Global = True
RE.Pattern = "\b[a-z]+\b"
Debug.Print RE.Replace("Findings,Actions", "xyz")
End Sub
xyz,xyz
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句