Those Questions Are Too Broad
Both your question and the example question you gave are Too Broad, and should be closed according to Stack Overflow's current guidelines:
Questions which are too broad, unclear, incomplete or primarily opinion-based may be put on hold by the community until they are improved.
What Your Question Asks
Summarized below:
So what is the correct way to do this, how does disqus and stack-exchange do this? I haven't written any code, since I don't even have a method...
What Your Example Question Asks
Summarized below:
What is a good complete regular expression or some other process that would take the title:
How do you change a title to be part of the URL like Stack Overflow?
and turn it into
how-do-you-change-a-title-to-be-part-of-the-url-like-stack-overflow
that is used in the SEO-friendly URLs on Stack Overflow?
The development environment I am using is Ruby on Rails, but if there are some other platform-specific solutions (.NET, PHP, Django), I would love to see those too.
Questions About Stack Exchange
If you're interested about the implementation details of Stack Exchange sites, such questions would be on-topic here on Meta Stack Overflow if the question is specifically about Stack Overflow, or on-topic on Meta Stack Exchange if it's not specific to Stack Overflow, but would apply to Stack Exchange sites in general.
Note, however, that just because you ask about how something is implemented on a Stack Exchange site, the Stack Exchange team is not obligated to reveal to you all of their Intellectual Property secrets, though they've actually given some answers about various technologies and algorithms that they use.
Examples