[求助]应该算是返回字符串的问题吧??
问题是这样的我在数据库读出数据rs("text"),现在我想假如这个rs("text")中包含[ img ]*[/img]
便在rs("text")前面加上“[组图]”
其中*号为任意URL
具体应该怎样做??
[此贴子已经被作者于2007-8-27 13:56:07编辑过]
[此贴子已经被作者于2007-8-27 13:56:07编辑过]
2007-08-27 11:46
Function getImgStr(Str)
Dim ReVal
ReVal=Replace(Str,"[img]","[组图][img]")
getImgStr=ReVal
End Function
运用Replace查找和替换函数进行替换即可。
Replace([原始字符串],[查找的字符串],[替换的字符串])
2007-08-27 12:36
2007-08-27 13:55

2007-08-27 15:48
Function getImgStr(strng)
getImgStr=false
Dim RegEx, Match
Set RegEx = New RegExp
Regex.pattern = "[img]" Regex.pattern = "^[img]$"
RegEx.IgnoreCase = True
Set Match = RegEx.Execute(strng)
if match.count then getImgStr=True
End Function
if getImgStr(rs("text")) then if not(getImgStr(rs("text"))) then
response.write("[组图]"&rs("text"))
else
...............
end if
我改了这两处便行了~~~~谢谢楼上的
还有能解释一下这个Function的意思吗??
主要是那个pattern是怎样用的??

2007-08-28 09:29