Home > Backend Development > PHP Tutorial > 求一个不能存在空格的js正则,所有的类型的!

求一个不能存在空格的js正则,所有的类型的!

WBOY
Release: 2016-06-23 13:28:22
Original
961 people have browsed it

var reg = /^\s*$/g;
if (name = '' || reg.test(name) || reg.test(tag)){
top.swal('出错了','修改内容不能为空','','error');
return false;
}

百度搜的还是出错!


回复讨论(解决方案)

/\s*/ 这样子

不行啊  我随便输入一个  然后打了好多空格 还是不行

/\s*/ 这样子

不行

/^\S*$/

/^\S*$/


  效果很好      你这个还能加一个空格都不能打的吗? 
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template