正则表达式的例子

来源:百度知道 编辑:UC知道 时间:2024/05/14 11:45:44
Function ReplaceUserFunctionLabel(Content)
Dim regEx, Matches, SqlLabel,Match
Dim Matchn,n
Set regEx = New RegExp
regEx.Pattern = "{SQL_[^{]*\)}"
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(Content)
ReplaceUserFunctionLabel=Content
For Each Match In Matches
SqlLabel=Match.value
ReplaceUserFunctionLabel=Replace(ReplaceUserFunctionLabel,SqlLabel,ReplaceDIYFunctionLabel(SqlLabel,"label"))
Next
End Function

Function ReplaceUserFunctionLabel(Content)
Dim regEx, Matches, SqlLabel,Match
Dim Matchn,n
Set regEx = New RegExp
regEx.Pattern = "{SQL_[^{]*\)}"
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(Content)
ReplaceUserFunctionLabel=Content
For Each Match In Matches
SqlLabel=Match.value
ReplaceUserFunctionLabel=Replace(ReplaceUserFunctionLabel,SqlLabel,ReplaceDIYFunctionLabel(SqlLabel,"label"))
Next
End Function

回答正确