正则,获得数字后,如何再调用函数?

iamduo 2005-07-25 06:10:10
Dim reg,s
Set reg = New RegExp
reg.IgnoreCase = True
reg.Global = true
reg.Pattern = "(<)(.*?)(>)"
s =reg.Replace(temp,GetMyInfo("$2"))
Set reg=nothing
Response.Write(s)
================================
我的原意是,将temp中格式如<1>或者<2>的东东,替换成,我另一个函数里面修改的内容。
数字“1”,“2”作为函数GetMyInfo的参数。
比如:
temp="a<1>b<2>"
GetMyInfo的作用是,接受到1返回a,接受到2返回b
结果应该是:aabb
...全文
117 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
iamduo 2006-04-26
  • 打赏
  • 举报
回复
难题
sunway8110 2006-04-12
  • 打赏
  • 举报
回复
reg.Pattern = "(<)(.*?)(>)"
Set oMatches = reg.Execute(temp)
For Each oMatch In oMatches
'SubMatches好像是从0开始,如果是从1开始,则改为oMatch.SubMatches(2)
Response.Write(oMatch.SubMatches(1) & "<br/>")
s =reg.Replace(temp,GetMyInfo(oMatch.SubMatches(1)))
Next
iamduo 2006-04-12
  • 打赏
  • 举报
回复
自己up
iamduo 2006-02-20
  • 打赏
  • 举报
回复
给点提示吧
llsljh 2005-07-25
  • 打赏
  • 举报
回复
up~!

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧