Here you can find the source of slugify(final String s)
public static String slugify(final String s)
//package com.java2s; //License from project: Apache License import java.text.Normalizer; public class Main { public static String slugify(final String s) { //algorithm used in https://github.com/slugify/slugify/blob/master/core/src/main/java/com/github/slugify/Slugify.java return Normalizer.normalize(s, Normalizer.Form.NFD).replaceAll("[^\\p{ASCII}]", "") .replaceAll("[^\\w+]", "-").replaceAll("\\s+", "-").replaceAll("[-]+", "-").replaceAll("^-", "") .replaceAll("-$", "").toLowerCase(); }//from w w w . j a v a 2 s.co m }