Regex to check if whitespace present?

后端 未结 5 1786
失恋的感觉
失恋的感觉 2021-02-13 01:21

Seems pretty simple, but cannot figure out why this javascript code isn\'t working returning false, when expecting true) - I\'m guessing it has got to do something with the esca

5条回答
  •  花落未央
    2021-02-13 01:43

    If you want to match something there, but no whitespace:

    alert(/^\S+$/.test(value));
    

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题