<%
str = "文字1,""文,字,2"",文字3,""文,字4"""
'文字1,"文,字,2",文字3,"文,字4"欲以<b style="color:black;background-color:#a0ffff">逗號</b>分割之
response.write "錯誤:" & "<br>"
arr = split(str,",")
for i = 0 to ubound(arr)
response.write arr(i) & "<br>"
next
response.write "<hr>正確:" & "<br>"
Set re = New RegExp
With re
.Pattern = """[^""]+"""
.IgnoreCase = False
.Global = True
End With
Set matchArr = re.Execute(str)
matchIndex = 0
uniStr = "bryan5201314"
newStr = re.Replace(str,uniStr)
newArr = split(newStr,",")
for i = 0 to ubound(newArr)
if newArr(i) = uniStr then
newArr(i) = Replace(matchArr(matchIndex),"""","")
matchIndex = matchIndex + 1
end if
response.write newArr(i) & "<br>"
next
Set re = nothing
留言列表