p=/^\d{2,4}$/g;
s='55 44';
ss=s.replace(/\s/,'')+'|';
alert(p.test(ss));
已经去空格了,为什么还是false?谢谢讲解
------解决方案--------------------
- JScript code
p=/^\d{2,4}$/g;//字符串中只含有2到4个数字
s='55 44';
ss=s.replace(/\s/,'')+'|';//ss='5544|'
alert(p.test(ss));
------解决方案--------------------
p=/^\d{2,4}$/g;
ss=s.replace(/\s/,'')+'|';
------解决方案--------------------
多了'|'