简体   繁体   English

正则表达式匹配空格或javascript

[英]regex match blank or spaces javascript

I'm looking for a regex pattern that matches the following values: 我正在寻找与以下值匹配的正则表达式模式:

  • an empty string, or 一个空字符串,或者
  • a string that contains only spaces. 一个仅包含空格的字符串。

Thanks 谢谢

You could use this regex: 您可以使用此正则表达式:

/^\s*$/

Start of string 
Followed by zero or more whitespace 
End of string

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM