当前位置: 代码迷 >> ASP >> aa[u]baabaa[/u],正则能将[u][/u]间的aa替换成cc吗?该怎么解决
  详细解决方案

aa[u]baabaa[/u],正则能将[u][/u]间的aa替换成cc吗?该怎么解决

热度:368   发布时间:2012-02-05 12:07:15.0
aa[u]baabaa[/u],正则能将[u][/u]间的aa替换成cc吗?
aa[u]baabaa[/u],正则能将[u][/u]间的aa替换成cc吗?

------解决方案--------------------
str = "aa[u]baabaa[/u] "
Set regEx = New RegExp
regEx.Pattern = "\[u\][\s\S]*?aa\[/u\] "
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(str)
For Each Match In Matches
temp = Replace(Match.Value, "aa ", "cc ")
str = Replace(str, Match.Value, temp)
Next
response.write str