建立正则对象
Set regEx=New RegExp ‘建立正则对象
属性:
regEx.Pattern=vpattern ‘获取正则表达式
regEx.IgnoreCase=True ‘是否区分大小写匹配
regEx.Global=True ‘是否进行全局匹配
方法:
Set Matches=regEx.Execute(str) ‘对str进行搜索,返回匹配到的Matches集合
regEx.Replace(str1,str2) ‘用str2替换 str1中匹配到的字符串
regEx.Test(str) ‘测试str中是否有符合匹配,有则返回True
2.集合对象(Matches)的使用
Set Matches=regEx.Execute(str) ‘对str进行搜索,返回匹配到的Matches集合
属性:
Matches.Count ‘匹配到的个数
Matches.Item(i) ‘第i个匹配到的字符串
注意:Matches.Item(i)=Matches(0).Value=Matches(I)
方法: 无
3.单个集合对象(Match)的使用
……