1.这个函数是判断输入的字符串是否符合格式要求,格式可以根据需要进行实例化
Function RegExpTest(patrn,strng)
Dim regEx
Set regEx = new RegExp
regEx.Pattern= patrn
regEx.Ingorecase =True
regEx.Global = True
RegExpTest = regEx.Test("strng")
If RegExpTest = True Then
Reporter.ReportEvent micPass,"输入格式测试","输入格式正确"
else
Reporter.ReportEvent micFail,"输入格式测试","输入格式不正确"
End If
End Function
2.以Email地址为例
mail_patrn ="^[a-zA-Z0-9_\-]@[a-zA-Z0-9_\-]\.[a-zA-Z0-9_\-.]{1,}$"
strng = Browser("后台管理").Page("用户管理_2").WebEdit("vo.email").GetROProperty("value")
result_message=RegExpTest(mail_pattern,strng)
Function RegExpTest(patrn,strng)
Dim regEx
Set regEx = new RegExp
regEx.Pattern= patrn
regEx.Ingorecase =True
regEx.Global = True
RegExpTest = regEx.Test("strng")
If RegExpTest = True Then
Reporter.ReportEvent micPass,"输入格式测试","输入格式正确"
else
Reporter.ReportEvent micFail,"输入格式测试","输入格式不正确"
End If
End Function
2.以Email地址为例
mail_patrn ="^[a-zA-Z0-9_\-]@[a-zA-Z0-9_\-]\.[a-zA-Z0-9_\-.]{1,}$"
strng = Browser("后台管理").Page("用户管理_2").WebEdit("vo.email").GetROProperty("value")
result_message=RegExpTest(mail_pattern,strng)