这个正则表达式函数中的$1,$2,$3是什么意思?
<%PublicFunctionUbbcode(strcontent)dimreSetre=newRegExpre.IgnoreCase=truere.Global=Tr...
<%
Public Function Ubbcode(strcontent)
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
'strcontent=Replace(strcontent,"file:","file :")
'strcontent=Replace(strcontent,"files:","files :")
'strcontent=Replace(strcontent,"script:","script :")
'strcontent=Replace(strcontent,"js:","js :")
'图片UBB
re.pattern="\[img\](http|https|ftp):\/\/(.[^\[]*)\[\/img\]"
strcontent=re.replace(strcontent,"<a onfocus=""this.blur()"" href=""$1://$2"" target=new><img src=""$1://$2"" border=""0"" alt=""按此在新窗口浏览图片"" onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></a>")
'链接UBB
re.pattern="(\[url\])(.[^\[]*)(\[url\])"
strcontent= re.replace(strcontent,"<a href=""$2"" target=""new"">$2</a>")
re.pattern="\[url=(.[^\[]*)\]"
strcontent= re.replace(strcontent,"<a href=""$1"" target=""new"">")
'邮箱UBB
re.pattern="(\[email\])(.*?)(\[\/email\])"
strcontent= re.replace(strcontent,"<img align=""absmiddle"" ""src=image/email1.gif""><a href=""mailto:$2"">$2</a>")
re.pattern="\[email=(.[^\[]*)\]"
strcontent= re.replace(strcontent,"<img align=""absmiddle"" src=""image/email1.gif""><a href=""mailto:$1"" target=""new"">")
问题如题目,最好给我稍微解释下一两个正则表达式替换是怎么实现的,随便说说就行!满意加分! 展开
Public Function Ubbcode(strcontent)
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
'strcontent=Replace(strcontent,"file:","file :")
'strcontent=Replace(strcontent,"files:","files :")
'strcontent=Replace(strcontent,"script:","script :")
'strcontent=Replace(strcontent,"js:","js :")
'图片UBB
re.pattern="\[img\](http|https|ftp):\/\/(.[^\[]*)\[\/img\]"
strcontent=re.replace(strcontent,"<a onfocus=""this.blur()"" href=""$1://$2"" target=new><img src=""$1://$2"" border=""0"" alt=""按此在新窗口浏览图片"" onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></a>")
'链接UBB
re.pattern="(\[url\])(.[^\[]*)(\[url\])"
strcontent= re.replace(strcontent,"<a href=""$2"" target=""new"">$2</a>")
re.pattern="\[url=(.[^\[]*)\]"
strcontent= re.replace(strcontent,"<a href=""$1"" target=""new"">")
'邮箱UBB
re.pattern="(\[email\])(.*?)(\[\/email\])"
strcontent= re.replace(strcontent,"<img align=""absmiddle"" ""src=image/email1.gif""><a href=""mailto:$2"">$2</a>")
re.pattern="\[email=(.[^\[]*)\]"
strcontent= re.replace(strcontent,"<img align=""absmiddle"" src=""image/email1.gif""><a href=""mailto:$1"" target=""new"">")
问题如题目,最好给我稍微解释下一两个正则表达式替换是怎么实现的,随便说说就行!满意加分! 展开
展开全部
$1,$2,$3和正则表达式无关,这个代码应该是放在服务器上运行的,相当于一个变量。执行完之后,$1,$2,$3就被赋予实际的值了。这里起个站位的作用。
正则表达式内容有点多哦,大概说一下
^表示开始
$结尾
\用来转义
[a-z]指的范围在a-z
[a-z]{6}6位a-z范围的值
[a-z]*不限制长度范围
在需要详细的你就要去参考资料了
正则表达式内容有点多哦,大概说一下
^表示开始
$结尾
\用来转义
[a-z]指的范围在a-z
[a-z]{6}6位a-z范围的值
[a-z]*不限制长度范围
在需要详细的你就要去参考资料了
参考资料: http://baike.baidu.com/view/94238.html?wtp=tt
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询