javascript - Regular validation of empty string
漂亮男人
漂亮男人 2017-06-12 09:32:21
0
3
707

I want to verify whether the beginning or end of the string is a space. Why is the result true regardless of orgName?

var orgName = "";
var reg = /(^\s*|\s*$)/;
if (reg.test(orgName)) {
} else {
    alert("输入内容不符合规范");
}
漂亮男人
漂亮男人

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!