// insert a dash between chars String cute = "AA54BG4G3G".replaceAll( "(\\w{2})(?!$)", "$1:" ); // cute is "AA-54-BG-4G-3G"