title: Uppercase each first letter of words with preg_replace
body: <p>So I have some sentences I am inserting into a database with some auto-correction processes. The following sentence:</p>
  
  <pre><code>$sentence = "Is this dog your's because it can't be mine";
  </code></pre>
  
  <p>And the following code to capitalize each word but make sure it doesn't capitalize contractions (eg. n't):</p>
  
  <pre><code>str_replace(
      "'S", "'s", preg_replace(
         "/(\w+)n'T?/", "$1n't", (
             preg_replace(
                "/\b[a-z]/e", 
                'strtoupper("$0")', 
                ucwords($sentence)
             )
         )
     )
  );
  </code></pre>
  
  <p>When echoing, the result is as follows:</p>
  
  <pre><code>Is This Dog Your's Because It Can't Be Mine
  </code></pre>
  
  <p>This is what I want it to do, however, what it inputs into my MySQL database is:</p>
  
  <pre><code>Is This Dog Your's Because It Can'T Be Mine
  </code></pre>
  
  <p>I have no idea why this is happening... I am assuming that I messed something up somewhere.</p>