87,915
社区成员
发帖
与我相关
我的任务
分享
var sToMatch = "abcde";
document.write(sToMatch.replace(/.+/gi,"*") + " <br>"); //输出:*
document.write(sToMatch.replace(/a*/gi,"*") + " <br>"); //输出:**b*c*d*e*
var sToMatch = "";
document.write(sToMatch.replace(/.+/gi,"*") + " <br>"); //输出:
document.write(sToMatch.replace(/.*/gi,"*") + " <br>"); //输出:*