regular expression to match an empty (or all whitespace) string

php, regex

Solution

You don't need regular expressions for that, just use:

if ( Trim ( $str ) === '' ) echo 'empty string';

Problem

i want to match a string that can have any type of whitespace chars (specifically I am using PHP). or any way to tell if a string is empty or just has whitespace will also help!

Original source