Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 从html页面的许多不同结构中获取链接的最佳正则表达式字符串_Regex_Vb.net - Fatal编程技术网

Regex 从html页面的许多不同结构中获取链接的最佳正则表达式字符串

Regex 从html页面的许多不同结构中获取链接的最佳正则表达式字符串,regex,vb.net,Regex,Vb.net,我正在解析来自许多不同HTML数据结构的链接,到目前为止,我当前的正则表达式字符串对其中大多数都有效。然而,我遇到过这样一个链接结构的域,我也希望能够抓住它们 <a href="http://www.domain.dk/eportal/kontakt.asp"><font face="Verdana" size="2"></font></a> 在锚文本中,但这不起作用,可能是

我正在解析来自许多不同HTML数据结构的链接,到目前为止,我当前的正则表达式字符串对其中大多数都有效。然而,我遇到过这样一个链接结构的域,我也希望能够抓住它们

<a
                                    href="http://www.domain.dk/eportal/kontakt.asp"><font face="Verdana" size="2"></font></a>

在锚文本中,但这不起作用,可能是我做错了?

这适用于您提供的示例

/<a.*?href=["']?([^'">\ ]*)["']?[^>]*>.*<\/a>/is

/

FYI
[hrefHREF]
将只匹配一个字符
h、r、e、f、h、r、e
f
/<a.*?href=["']?([^'">\ ]*)["']?[^>]*>.*<\/a>/is