Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/video/2.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 ASP提取中的正则表达式_Regex_Asp Classic - Fatal编程技术网

Regex ASP提取中的正则表达式

Regex ASP提取中的正则表达式,regex,asp-classic,Regex,Asp Classic,好的,我来自PHP背景,但我需要使用经典ASP从URL中提取一些内容 $url = 'http://domain.com/page1/link.asp'; ASP代码将去掉http://或http://www,只提取 domain.com(第1页)(link.asp) 在PHP中,您可以使用preg_match函数,但是ASP版本如何工作?以下应该可以工作(未经测试): 这是工作。(测试) 这可能有助于: Dim regEx, strFinal Set regEx = New RegExp

好的,我来自PHP背景,但我需要使用经典ASP从URL中提取一些内容

$url = 'http://domain.com/page1/link.asp';
ASP代码将去掉http://或http://www,只提取 domain.com(第1页)(link.asp)

在PHP中,您可以使用preg_match函数,但是ASP版本如何工作?

以下应该可以工作(未经测试):

这是工作。(测试)

这可能有助于:
Dim regEx, strFinal

Set regEx = New RegExp
regEx.Pattern = "^https?://(www\.)?";
regEx.IgnoreCase = True

strFinal = regEx.Replace("http://domain.com/page1/link.asp", "")
Dim regEx, strFinal

Set regEx = New RegExp
regEx.Pattern = "^https?://(www\.)?"
regEx.IgnoreCase = True

strFinal = regEx.Replace("http://www.domain.com/page1/link.asp", "")
Response.Write strFinal