title: How does Stack Overflow generate its SEO-friendly URLs?
body: <p>What is a good complete <a href="http://en.wikipedia.org/wiki/Regular_expression" rel="noreferrer">regular expression</a> or some other process that would take the title:</p>
  
  <blockquote>
    <p>How do you change a title to be part of the URL like Stack Overflow?</p>
  </blockquote>
  
  <p>and turn it into </p>
  
  <pre class="lang-none prettyprint-override"><code>how-do-you-change-a-title-to-be-part-of-the-url-like-stack-overflow
  </code></pre>
  
  <p>that is used in the SEO-friendly URLs on Stack&nbsp;Overflow?</p>
  
  <p>The development environment I am using is <a href="http://en.wikipedia.org/wiki/Ruby_on_Rails" rel="noreferrer">Ruby on Rails</a>, but if there are some other platform-specific solutions (.NET, PHP, <a href="http://en.wikipedia.org/wiki/Django_%28web_framework%29" rel="noreferrer">Django</a>), I would love to see those too. </p>
  
  <p>I am sure I (or another reader) will come across the same problem on a different platform down the line. </p>
  
  <p>I am using custom routes, and I mainly want to know how to alter the string to all special characters are removed, it's all lowercase, and all whitespace is replaced.</p>