Create a permalink with Javascript

Posted by Jon Romero on Stack Overflow See other posts from Stack Overflow or by Jon Romero
Published on 2010-03-25T22:16:32Z Indexed on 2010/03/25 22:23 UTC
Read the original article Hit count: 571

Filed under:
|
|

I have a textbox where a user puts a string like this:

"hello world! I think that __i__ am awesome (yes I am!)"

I need to create a correct url like this:

hello-world-i-think-that-i-am-awesome-yes-i-am

How can be done using reg expressions?

Also, is it possible to do it with Greek (for example)?

"Ge?a s?? ??sµe"

turns to

geia-sou-kosme

In other programming languages (python/ruby) I am using a translation array. Should I do the same here?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about permalink