标签:ems amp line alert new news -- height item
*:匹配相连的全部数字,如例一
{n}:代表第几位数字,如例二
例一:
var str = "items=123456&abc=123";
var newstr = s.replace(/items=([0-9])*/g,"qw");
alert(newstr); //qw&abc=123
-------------------------------------------------------
例二:
var str = "items=123456&abc=123";
var newstr = s.replace(/items=([0-9]){3}/g,"qw");
alert(newstr); //qw456&abc=123
标签:ems amp line alert new news -- height item
原文地址:http://www.cnblogs.com/WebYan/p/6010015.html