lijianda

 

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")
}

 

分类:

技术点:

相关文章:

  • 2021-12-04
  • 2021-12-04
  • 2021-11-04
  • 2021-11-28
  • 2022-01-07
  • 2021-11-05
  • 2021-12-04
猜你喜欢
  • 2021-11-27
  • 2021-11-04
  • 2021-11-04
  • 2021-12-04
  • 2021-08-07
  • 2021-11-15
相关资源
相似解决方案