title: Postgres Function to Validate Email Address
body: <p>A check constraint which would call a function to validate email addresses is not working fine for me.</p>
  
  <pre><code>CREATE OR REPLACE FUNCTION f_IsValidEmail(text) returns BOOLEAN AS 
  'select $1 ~ ''^[^@\s]+@[^@\s]+(\.[^@\s]+)+$'' as result
  ' LANGUAGE sql;
  
  
  
  SELECT f_IsValidEmail('myemail@address.com');
  </code></pre>
  
  <p>The function is returning false, which should be true. I have tried a couple of other regexs but in vain. Can anyone point out what's wrong with this function?</p>
  
  <p><a href="http://i.stack.imgur.com/NpoSz.jpg" rel="noreferrer">Screenshot</a></p>