Regex or Regular Expression is used to specify different patterns and use them to match in a file or command output. Regex provides different predefined characters where whitespace
is one of the. Especially between words whitespaces are used to separate them. We can use the \s
in order to define whitespace.
Regex Whitespace
Regex whitespace matches single whitespace or space.
\s
Multiple Whitespaces
We can also match multiple whitespaces or spaces by using the *
after the \s .
\s*