private static String pluralize(String word)
        {

            if (uncountables.contains(word))
                return word;

            for (String[] irregular : irregulars)
            {
                if (irregular[0].equalsIgnoreCase(word))
                {
                    return irregular[1];
                }
            }

            for (String[] pair : plurals)
            {
                String plural = gsub(word, pair[0], pair[1]);
                if (plural != null)
                    return plural;
            }

            return word;
        }
Replaces a found pattern in a word and returns a transformed word. Null is pattern does not match.
protostuff-compiler/src/main/java/io/protostuff/compiler/Formatter.java