Code: Select all
<script language="javascript">
var newRowStr="abcabcabc";
var charO="a";
var charN="x";
document.write(newRowStr);
var reg1=eval("new RegExp(/"+charO+"/g);");
document.write("\n"+reg1+"\n");
newRowStr=newRowStr.replace(reg1,charN);
document.write(newRowStr);
</script>