<script language=javascript>
var x="A"
str1="Abc,Abc,Abc"
var re=new RegExp(x,"g");
str1=str1.replace(re,"a");
alert(str1);
</script>