var s1="     ** Total:         125 CARTONS                                        412.300    2.613";var s1="     ** Total:         125 CARTONS                                        412.300    2.613";求一正则表达式从上面的s1 中提取
125
412.300
2.613谢谢 

解决方案 »

  1.   


    Total\s*:\s*(\d+?)\s*CARTONS\s*(\d+\.?\d+)\s*(\d+\.?\d+)
      

  2.   


    <script>var s1=" ** Total: 125 CARTONS  412.300     2.613";alert(s1.match(/(?!\D)[^\s]+/g).join("\n"))</script>
      

  3.   

    or:<script>var s1=" ** Total: 125 CARTONS  412.300  2.613";alert(s1.match(/\d+(\.\d+)?/g).join("\n"))</script>
      

  4.   

            var s1 = " ** Total: 125 CARTONS 412.300 2.613";
            var i = s1.match(/\d+(?:\.\d+)?/g);
            alert(i);