<script language=javascript>
var ss = "The_{sc} rain_{st} in_{sx} Spain{sc} falls{sc}\n mainly_{st} in{st} {sx}{sc}the{st} plain{s}.";
var temp=new Array();
temp["sc"]="(this is sc)";
temp["st"]="[dd/xx]";
temp["sx"]="|haha|";
re = /\{((sc|st|sx))\}/g;
r = ss.replace(re, function(a,b){return temp[b]});
alert(r);
</script>
var ss = "The_{sc} rain_{st} in_{sx} Spain{sc} falls{sc}\n mainly_{st} in{st} {sx}{sc}the{st} plain{s}.";
var temp=new Array();
temp["sc"]="(this is sc)";
temp["st"]="[dd/xx]";
temp["sx"]="|haha|";
re = /\{((sc|st|sx))\}/g;
r = ss.replace(re, function(a,b){return temp[b]});
alert(r);
</script>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货