Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a Regular Expression for blank input?

Tags:

regex

This might be a silly question but is there a Regular Expression to validate for blanks or no user input at all?

like image 211
Tintin81 Avatar asked Dec 15 '25 12:12

Tintin81


1 Answers

Start of line immediately followed by end of line:

^$

Any amount of whitespace, including none:

^\s*$
like image 150
Pavel Anossov Avatar answered Dec 19 '25 05:12

Pavel Anossov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!