标签:code div span col var console 换行 pre pac
var test = " "; //为空或全部为空格 if (test.match(/^[ ]*$/)) { console.log("all space or empty"); }
var test = " \n "; //var test = " "; if(test.match(/^\s+$/)){ console.log("all space or \\n") } if(test.match(/^[ ]+$/)){ console.log("all space") } if(test.match(/^[ ]*$/)){ console.log("all space or empty") } //空|空格|换行 if(test.match(/^\s*$/)){ console.log("all space or \\n or empty") }
标签:code div span col var console 换行 pre pac
原文地址:https://www.cnblogs.com/lijianda/p/9732498.html