日期:2014-05-17 浏览次数:20992 次
s="年龄:20"&chr(10)&_ "住址:北京市东区"&chr(10)&_ "姓名:张三"&chr(10)&_ "个人主页:http://www.csdn.net" arrfield=array("name","age","addr","site") arrrx=array("^(姓名|名字)[::]([^\r\n]+)","^(年龄|年纪|岁数)[::]([^\r\n]+)","^(地址|住址)[::]([^\r\n]+)","^(个人主页|网址)[::]([^\r\n]+)") set rx=new regexp rx.Multiline=true rx.Global=true for i=0 to ubound(arrfield) rx.Pattern=arrrx(i) set mc=rx.Execute(s) if mc.count>0 then set m=mc(0) msgbox arrfield(i)&":"&m.submatches(1) else msgbox "找不到和“"&arrfield(i)&"”匹配的内容" end if next set rx=nothing