title: RegEx pattern to check for whitespace at the start or end of a string
body: <p>I know that <code>\s</code> is the pattern used to match any white space in a string. Now, my problem is what should be the exact regex pattern to check white space at the start or end of the string?</p>
  
  <p>So, if I have a string " hello world", white space is at the start, so it will return <code>true</code>. If the string is " hello world ", it will return <code>true</code> too. White space is at the start and end of the string.</p>
  
  <p>I don't need to remove white space but I just need to check if the data I got from the database has white space at the start or end.</p>
  
  <p>This is my SQL query but this doesn't really work. This only picks up data that has white space at the end:</p>
  
  <pre><code>select * from `data_table`
  where `data_content` regexp '[ \f\t\v]$';
  </code></pre>
  
  <p>The query above give me 7 results as there are only 7 records which have white space at the end. There are 3 records that I need to fetch which have white space at the start of the string.</p>
  
  <p>I tried running this SQL query:</p>
  
  <pre><code>select * from `data_table`
  where `data_content` regexp '^\s' || `data_content` regexp'\s$';
  </code></pre>
  
  <p>It gives me 87 results. I inspected the result one by one through PHPMYADMIN and the results I got are those data that have no white space in it.</p>