js正则练习以及经常使用正则

练习 取出"width:63px;"的数字 var str="width:63px;"; //第一种方式 var num=str.replace(/width:(\d*)px/,'$1'); console.log(num); //63 //第二种方式 var num=str.replace(/[^\d]/g,''); console.log(num); //63 //第三种方式 var num=
相关文章
相关标签/搜索