How to remove all characters between two brackets?
Such as "12345 (rtetnj) dsfd (fddsgd) dsf "----> "12345 dsfd dsf "
Use regexp syntaxes ,it's too simple .
Function StringWithoutBrackets(ByVal s As String) As String
With CreateObject("VBSCRIPT.REGEXP")
.Global = True
.Pattern = "[(][^)]*[)]"
StringWithoutBrackets = .Replace(s, "")
End With
End Function
With CreateObject("VBSCRIPT.REGEXP")
.Global = True
.Pattern = "[(][^)]*[)]"
StringWithoutBrackets = .Replace(s, "")
End With
End Function
Sub test()
MsgBox StringWithoutBrackets("12345 (rtetnj) dsfd (fddsgd) dsf ")
End Sub
本文介绍了一种使用正则表达式从字符串中移除所有位于括号内的字符的方法。通过VBScript实现,提供了具体的函数代码示例。
310

被折叠的 条评论
为什么被折叠?



