Regex token /g is not allowed in preg_match, so I started to use preg_match_all
I found that if I simplified the expression to:
preg_match_all('/^\s*$/', '') == 0
Then it works and the boolean value is negated if the string contains visible letters as:
preg_match_all('/^\s*$/', 'hello how are you') == 0
But if I change the string to a escape sequence (“\t\n”) or a space (” “) then it doesn’t work as expected which might explain why
preg_match_all('/^\s*$/', get_the_content()) == 0
works as expected only if there is visible content or nothing at all.