title: Test if a string is regex
body: <p>Is there a good way of test if a string is a regex or normal string in PHP?</p>
  
  <p>Ideally I want to write a function to run a string through, that returns true or false.</p>
  
  <p>I had a look at <code>preg_last_error()</code>:</p>
  
  <pre><code>&lt;?php
  preg_match('/[a-z]/', 'test');
  var_dump(preg_last_error());
  preg_match('invalid regex', 'test');
  var_dump(preg_last_error());
  ?&gt;
  </code></pre>
  
  <p>Where obviously first one is not an error, and second one is. But <code>preg_last_error()</code> returns <code>int 0</code> both times.</p>
  
  <p>Any ideas?</p>