Most Blog software provides an option to use a sanitized version of the post title as part of permalink url. Thingamablog, a Java based offline blogging software, doesn't do it. So I decided to create one for myself in Java.

To see an example of what I am talking about, see the permalink (permanent link) of this post - http://blog.taragana.com/index.php/archive/how-to-sanitize-blog-title-to-use-as-permalink-in-java/. It contains the title ( How to Sanitize Blog Title, to use as Permalink, in Java ) with '-' as separator, and without spaces, punctuations etc.

Here is what you would do to sanitize any text in Java:
title.replaceAll("[\W]+", "-")

Note: The second argument is the separator to use.

That's it! Isn't Java simple?