In my understanding you want to match a non-blank and non-empty string, so the top answer is doing the opposite. I suggest:
(.|\s)*\S(.|\s)*
This matches any string containing at least one non-whitespace character (the \S
in the middle). It can be preceded and followed by anything, any character or whitespace sequence (including new lines): (.|\s)*
.
You can try it with explanation on regex101.