存在するか
Public Function existRegexp(target, matchPattern, Optional ignoreCase = True) As Boolean 'ignoreCaseは大文字小文字区別するかどうか
Set regexp = CreateObject("VBScript.RegExp")
With regexp
.Pattern = matchPattern
.ignoreCase = ignoreCase
.Global = False
End With
existRegexp = regexp.test(target)
End Function
正規表現のマッチング取得
Public Function getRegexp(target, matchPattern, Optional ignoreCase = True, Optional global_ = True) 'ignoreCaseは大文字小文字区別するかどうか global_は複数回マッチングするかどうか
Set regexp = CreateObject("VBScript.RegExp")
With regexp
.Pattern = matchPattern
.ignoreCase = ignoreCase
.Global = global_
End With
Set getRegexp = regexp.Execute(target)
End Function