Inflector { protected static String replaceAllWithUppercase( String input, String regex, int groupNumberToUppercase ) { Pattern underscoreAndDotPattern = Pattern.compile(regex); Matcher matcher = underscoreAndDotPattern.matcher(input); StringBuffer sb = new StringBuffer(); while (matcher.find()) { matcher.appendReplacement(sb, matcher.group(groupNumberToUppercase).toUpperCase()); } matcher.appendTail(sb); return sb.toString(); } Inflector(); protected  Inflector( Inflector original ); static final Inflector getInstance(); @Override Inflector clone(); String pluralize( Object word ); String pluralize( Object word,
                             int count ); String singularize( Object word ); String lowerCamelCase( String lowerCaseAndUnderscoredWord,
                                  char... delimiterChars ); String upperCamelCase( String lowerCaseAndUnderscoredWord,
                                  char... delimiterChars ); String camelCase( String lowerCaseAndUnderscoredWord,
                             boolean uppercaseFirstLetter,
                             char... delimiterChars ); String underscore( String camelCaseWord,
                              char... delimiterChars ); String capitalize( String words ); String humanize( String lowerCaseAndUnderscoredWords,
                            String... removableTokens ); String titleCase( String words,
                             String... removableTokens ); String ordinalize( int number ); boolean isUncountable( String word ); Set<String> getUncountables(); void addPluralize( String rule,
                              String replacement ); void addSingularize( String rule,
                                String replacement ); void addIrregular( String singular,
                              String plural ); void addUncountable( String... words ); void clear();  }
@Test public void shouldReplaceAllWithUppercase() { assertEquals("hEllO", Inflector.replaceAllWithUppercase("hello", "([aeiou])", 1)); assertEquals("hLlo", Inflector.replaceAllWithUppercase("hello", "([aeiou])(l)", 2)); }