<script> var str = "eaeaeaea"; var strAfterFormat = str.replace(/e/g,'b') alert(strAfterFormat); </script>