javascript正则表达式显示千分位货币

js 代码
  1. <script language="JavaScript">   
  2. n="1279834847944074100465236.33"  
  3. re=/(\d{1,3})(?=(\d{3})+(?:$|\.))/g   
  4. n1=n.replace(re,"$1,")   
  5. alert(n+"\r\n"+n1)   
  6. document.write(n+"\r\n"+n1);  
  7. </script>

你可能感兴趣的:(JavaScript,正则表达式)