title: Regex to check if a string has only spaces
body: <p>I want a regular expression to check if a string has only spaces.</p>
  
  <p>Example: " "</p>
  
  <p>I'm currently using this regex </p>
  
  <pre><code>[/^ *$/]
  </code></pre>
  
  <p>But it's also detecting a string which has words in it.</p>
  
  <p>Example: "abc xyz"</p>
  
  <p>I want to use this regex in a postgresql function like following</p>
  
  <pre><code>IF r.colmn IS NULL  OR CAST(r.colmn as text) = '' 
         OR CAST(r.colmn as text) ~ '[/^ *$/]' -- regex not working
  THEN
       RAISE NOTICE 'Do something';       
  END IF;
  </code></pre>
  
  <p>Is there any regex I can use in a postgresql function which only checks for a string with only spaces?</p>