经典ASP VB中的正则表达式 [英] Regex in Classic ASP VB

查看:71
本文介绍了经典ASP VB中的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想匹配第一个实例,有人可以让我知道您将如何做吗?

I just want to match the first instance, could anyone let me know how you would go about doing this?

'RegEx to get Image
Dim re, matches, Img
Set re = new RegExp     ' creates the RegExp object
re.IgnoreCase = true
re.Global = true
re.Pattern = "<img.*(.|\n)*?/>"
Set Matches  = re.Execute(string)
Img = ""

For each Item in Matches
   Img = Item.Value
Next

推荐答案

Global属性应为false,而不是true.

该属性在 http://中进行了描述msdn.microsoft.com/zh-CN/library/tdte5kwf(v=VS.85).aspx .

这篇关于经典ASP VB中的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆