<script> value = "260000руб." var out = value.replace(/^([^\d]*)([\d]*)/g,'$2 $1').replace(/(\d)(?=(\d\d\d)+([^\d]|$))/g, '$1.'); document.write(out) </script>