How to Sanitize Blog Title, to use as Permalink, in Java

By Angsuman Chakraborty, Gaea News Network
Sunday, June 12, 2005

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 - https://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?

Discussion
February 15, 2007: 6:38 am

بدالله عبدالقوي غانم الحميري طالب جامعي من مواليد الدير عوابل شعوبة مديرية المعافر حجرية محافضة تعز طالب جامعي جامعة صنعاء كلية التجارة

YOUR VIEW POINT
NAME : (REQUIRED)
MAIL : (REQUIRED)
will not be displayed
WEBSITE : (OPTIONAL)
YOUR
COMMENT :