求个字符串处理实现

kenshin17 2008-10-09 11:20:59
需要从一个url中获得host的字符串
比如从http://www.123123.com/bbs/test.asp中取出http://www.123123.com

不会asp,请大侠们帮忙实现一下,谢谢!
...全文
67 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
toury 2008-10-09
  • 打赏
  • 举报
回复

wholeURL = "http://www.123123.com/bbs/test.asp"
s = Replace(wholeURL, "http://", "")
hostURL = "http://" & Split(s, "/")(0)
response.write hostURL
kenshin17 2008-10-09
  • 打赏
  • 举报
回复
谢谢楼上的,可以用
Atai-Lu 2008-10-09
  • 打赏
  • 举报
回复

Function getStr(fString,patrn)
dim str
str=""
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
Set reg=regEx.execute(fString)
int i=0
for i=0 to (reg.count-1)
if i=(reg.count-1) then
str = str & reg(i)
else
str = str & reg(i) & "|"
end if
next
getStr=str
End Function
str="http://www.123123.com/bbs/test.asp"
Response.Write(str,"http\:\/\/[^\/]+")
'//试试这个
yangzixp 2008-10-09
  • 打赏
  • 举报
回复
正则 :http://[^/]+

28,390

社区成员

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

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