当前位置: 代码迷 >> JavaScript >> 能用正则把前面的数字去掉如何写
  详细解决方案

能用正则把前面的数字去掉如何写

热度:146   发布时间:2012-03-22 17:43:57.0
能用正则把前面的数字去掉怎么写?
16//   OF   ANY   KIND,   EITHER   EXPRESSED   OR   IMPLIED,   INCLUDING   BUT   NOT
    17//   LIMITED   TO   THE   IMPLIED   WARRANTIES   OF   MERCHANTABILITY   AND/OR
    18//   FITNESS   FOR   A   PARTICULAR   PURPOSE.
    19//==============================================================================
    20
    21using   System;
    22using   System.Data;
    23using   System.Xml;
    24using   System.Data.SqlClient;
    25using   System.Collections;


------解决方案--------------------
<script language=javascript>
var s= "16// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT ";
re=/^\d+/gi;
s=s.replace(re, " ");
alert(s);
</script>
------解决方案--------------------
/^\d+/gm

用 EmEditor 文本处理软件正则替换比较方便:^\d+

------解决方案--------------------
re=/\s*^\d+/gi;
------解决方案--------------------
re=/^\s*\d+/gi;
  相关解决方案