0

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

$url = 'http://domain.com/page1/link.asp';

ASP 代码将去除 http:// 或 http:// www 并仅提取 domain.com (page1) (link.asp)

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

4

2 回答 2

1

以下应该有效(未经测试):

Dim regEx, strFinal

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

strFinal = regEx.Replace("http://domain.com/page1/link.asp", "")
于 2013-01-16T20:54:33.767 回答
0

这是工作。(经测试)

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
于 2014-09-13T08:52:48.577 回答