title: Regex pattern in JSON?
body: <p>I'm trying to have a single JSON file to validate data both in front (JS) and back (PHP).
  I cannot figure out how to have my pattern in a json string, PHP won't convert it.
  Here's what I'd like to use (email validation):</p>
  
  <pre><code>'{"name":"email", "pattern":"^[a-z0-9]+(\.[_a-z0-9]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,15})$"}'
  </code></pre>
  
  <p>I suppose there's something in pattern that doesn't get treated as a string? This as it is, won't convert to an object in PHP. I shouldn't have to escape anything but I might be wrong...</p>
  
  <p>thanks</p>
  
  <p>Edit: Tried this as suggested in comments:</p>
  
  <pre><code>json_decode('{"name":"email", "pattern":"^[a-z0-9]+(\\.[_a-z0-9]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,15})$"}‌​');  ==&gt; NULL
  </code></pre>