I can\'t find the regex for strings containing only whitespaces or integers. The string is an input from user on keyboard. It can contain everything but \\n (bu
\\n
To match only a whitespace or a digit you could use:
^[ 0-9]+$
That would match from the beginning of the string ^ one or more whitespaces or a digit using a character class [ 0-9]+ until the end of the string $.
^
[ 0-9]+
$