简体   繁体   English

空白输入是否有正则表达式?

[英]Is there a Regular Expression for blank input?

这可能是一个愚蠢的问题,但是有一个正则表达式来验证blanks或根本没有用户输入吗?

Start of line immediately followed by end of line: 行开始后紧接着行尾:

^$

Any amount of whitespace, including none: 任何数量的空白,包括无:

^\s*$

^$ should do the trick. ^$应该做的伎俩。 ^ matches the beginning and $ the end of the string. ^匹配字符串的开头和$结尾。

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

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