最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
为字符串中的网址加上链接的程序例子
时间:2022-06-30 10:54:07 编辑:袖梨 来源:一聚教程网
Function ToLink(Str)
Dim RE '正则表达式对象
Dim strContent
If IsNull(Str) Then Str=""
Set RE = New RegExp '创建正则表达式对象
With RE
.Global = True '搜索应用于整个字符串
.IgnoreCase = True '搜索不区分大小写的
strContent=Str
'***************************************************************
'邮件地址链接自动设置
'***************************************************************
.Pattern="([w]*)@([w.]*)"
strContent=.Replace(strContent," ")
'***************************************************************
'链接自动设置
'***************************************************************
'======根据要求再添加协议名称=======
Dim D(3),I
D(0)="http"
D(1)="ftp"
D(2)="news"
D(3)="mms"
'===================================
For I=0 To UBound(D)
.Pattern=D(I) + "://([w.]*)"
strContent=.Replace(strContent," ")
Next
'***************************************************************
End With
Set RE=Nothing
ToLink=strContent
End Function
Dim RE '正则表达式对象
Dim strContent
If IsNull(Str) Then Str=""
Set RE = New RegExp '创建正则表达式对象
With RE
.Global = True '搜索应用于整个字符串
.IgnoreCase = True '搜索不区分大小写的
strContent=Str
'***************************************************************
'邮件地址链接自动设置
'***************************************************************
.Pattern="([w]*)@([w.]*)"
strContent=.Replace(strContent," ")
'***************************************************************
'链接自动设置
'***************************************************************
'======根据要求再添加协议名称=======
Dim D(3),I
D(0)="http"
D(1)="ftp"
D(2)="news"
D(3)="mms"
'===================================
For I=0 To UBound(D)
.Pattern=D(I) + "://([w.]*)"
strContent=.Replace(strContent," ")
Next
'***************************************************************
End With
Set RE=Nothing
ToLink=strContent
End Function
相关文章
- 漫蛙漫画官方正版网页入口直达 12-14
- 快手官网网页版登录入口-在线观看快手官网网页版 12-14
- 新浪微博网页版手机端-新浪微博手机网页版快捷入口 12-14
- 免费漫画app官方主入口-官网直接访问入口 12-14
- 速卖通官网首页直达AliExpress-速卖通官方入口网址 12-14
- 网页版微博入口-网页版微博在线登录使用 12-14