title: Create a permalink with JavaScript
body: <p>I have a textbox where a user puts a string like this:</p>
  
  <pre><code>"hello world! I think that __i__ am awesome (yes I am!)"
  </code></pre>
  
  <p>I need to create a correct URL like this:</p>
  
  <pre><code>hello-world-i-think-that-i-am-awesome-yes-i-am
  </code></pre>
  
  <p>How can it be done using regular expressions?</p>
  
  <p>Also, is it possible to do it with Greek (for example)?</p>
  
  <pre><code>"Γεια σου κόσμε"
  </code></pre>
  
  <p>turns to</p>
  
  <pre><code>geia-sou-kosme
  </code></pre>
  
  <p>In other programming languages (<a href="http://en.wikipedia.org/wiki/Python_%28programming_language%29" rel="noreferrer">Python</a>/<a href="http://en.wikipedia.org/wiki/Ruby_%28programming_language%29" rel="noreferrer">Ruby</a>) I am using a translation array. Should I do the same here?</p>