Set regEx = New RegExp
regEx.Pattern ="(\[bk\])(..\img\background.gif)(\[\bk\])"
RegExpReplace = regEx.Replace(str1, "$1"+string2+"$3") ' 作替换。试试
regEx.Pattern ="(\[bk\])(..\img\background.gif)(\[\bk\])"
RegExpReplace = regEx.Replace(str1, "$1"+string2+"$3") ' 作替换。试试
<script language="JavaScript"> str="[bk]..\img\background.gif[\\bk]"
var re = /(\[bk\])(.+?)(\[\\bk\])/ig;
alert(str.replace(re,"$1新替换的$3"));
</script>