正規表現を用いた文字列チェック
'正規表現を用いた文字列チェック '要ScriptControl Function regcheck(strExp As String, strtest As String) Dim Reg As Object On Error GoTo regcheck_err Set Reg = CreateObject("VBScript.RegExp") Reg.Global = True '文字列全体を対象に走査する Reg.IgnoreCase = False '大文字小文字を区別する '検索パターン Reg.Pattern = strExp '検索実行 If Reg.Test(strtest) = False Then regcheck = False Else regcheck = True End If Set Reg = Nothing Exit Function regcheck_err: On Error Resume Next Set Reg = Nothing MsgBox "Err=" & Err.Number & ":" & Err.Description, , "regcheck" regcheck = False Exit Function End Function