kitfox checking if the entire string matches a regular expression
You can anchor the regex to the beginning and end of the string. ^ matches the beginning of the string and $ matches the end. This matches a string containing only whitespace:
re.compile("^\\s*$")
Alternatively, you could search for a non-whitespace character. If the string has at least one non-whitespace character, then it's not a string containing only whitespace. Inside brackets, ^ at the beginning negates the following character specification. This matches a non-whitespace character:
re.compile("[^\\s]")
This is equivalent to the previous:
re.compile("\\S")
I haven't verified that all of the above is supported by Godot's Regex class, but I've used some complex regex patterns, and they worked as expected.