title: create safe title from string
body: <p>moving a lot more of my old php functions to jquery alternatives. I'm a bit stuck on creating a decent preg_match function.</p>
  
  <p>Is there an easy way to make strings url safe &amp; seo'd?</p>
  
  <p>php;</p>
  
  <pre><code>function superClean($str){
  
  $str = strtolower($str);
  $str = str_replace(" ", "-", $str);
  $str = preg_replace('/[^a-z0-9_]/i', '-', $str);
  $str = preg_replace('/_[_]*/i', '-', $str);
  $str = str_replace('---', '-', $str);
  $str = str_replace('--', '-', $str);
  $str = str_replace('-s-', 's-', $str);
  
  return $str;
  
  }
  </code></pre>