How to search empty string, spaces, new lines etc through one line regular expression?
We can use a \s
to search empty string, spaces, new lines etc.
Regular expression will be :
^\s*$
Explanation of the regex :
^ : Represents starting of the string.
\s : Represents represents space, \r (carriage return), \n (new line), \t (tab), \v (vertical whitespace character) etc.
* : Repeats \s 0 or more times
$ : Represents ending of the string
Demo link : https://regex101.com/r/NqmV8z/1