注册 登录
编程论坛 ASP技术论坛

又有新问题了

moteheart1 发布于 2008-08-19 14:04, 558 次点击
请教个问题
有个一个字符串
比如[ img ] http://www.[ /img ]
怎么才能获得[img][/img]中的内容
用VB
5 回复
#2
tianyu1232008-08-19 14:57
用left()与right()
#3
lele20072008-08-19 23:45
如果用recplace替换替换后就是剩下的内容啦!呵呵!
#4
yms1232008-08-20 00:01
标签截取算法
标签结束位置-标签开始位置是标签的内容的字数。
比如楼主的问题
Dim Str,Start,End
Str="[ img ] http://www.[ /img ]"
Start=InStr(Str,"[ img ]")'求标签开始位置
End=InStr(Str,"[ /img ]")'求标签结束位置
Response.Write Mid(Str,Start,End-Start)'取标签内的内容
基本的原理是这样注意Mid函数End-Start
#5
anlige2008-08-20 03:51
UBB嘛~~~
#6
anlige2008-08-20 03:52
dim re
    Set re=new RegExp
    re.IgnoreCase =true
    re.Global=True
   
       '图片UBB
    re.pattern="\[img\](http|https|ftp):\/\/(.[^\[]*)\[\/img\]"
1