Regex r = new Regex(@"^\d+$"); if (r.Match(vlannumber).Success) { sql += " and a.vlannumber=" + vlannumber; } else { sql += " and a.memo like '%" + vlannumber + "%'"; }…
using System; using System.Web; using System.Text; using System.Web.UI.WebControls; using System.Text.RegularExpressions; public class ValidateHelper { private static Regex RegNumber = new Regex("^[0-9]+$"); p…
var s ="总金额4500元"; var num= s.replace(/[^-]/ig,""); alert(num);// 上述示例会把数字匹配到直接转成数字: var s ="总金额4500元,利润:28"; var num = s.replace(/[^0-9]/ig,""); alert(num);//450028 如果遇到字符夹带数字的情况:上述就会直接转成数字拼接起来的方式: var nomuch = f…