【发布时间】:2017-05-23 07:24:00
【问题描述】:
我有一个 myRegex 函数来从字符串中提取正则表达式。当我运行使用该函数的查询时,我在多行上收到以下错误。
找不到方法或数据成员。
这是正则表达式函数:
Function myRegex(ByRef myString As String, ByVal pattern As String) As String
Dim rgx As New RegExp
Dim colMatches As MatchCollection
With rgx
.pattern = pattern
.ignoreCase = True
.Global = False
.Multiline = False
Set colMatches = .Execute(myString)
End With
If colMatches.Count > 0 Then
myRegex = colMatches(0).Value
Else
myRegex = ""
End If
End Function
这是我使用的查询:
SELECT myRegex(phone,"[0-9]+")
FROM table1
我检查了以下参考库:
- Microsoft VBScript 正则表达式 1.0
- Microsoft VBScript 正则表达式 5.5
【问题讨论】: