code: private static String translate(String word, List<Replacer> replacers){
          // Scan uncountables and leave alone
          for(String uncountable: uncountables){
              if(uncountable.equals(word))
                  return word;
          }
  
          // Scan our patterns for a match and return the correct replacement
          for(Replacer replacer: replacers){
              Matcher matcher = replacer.pattern.matcher(word);
  
              if(matcher.matches()){
                  StringBuffer sb = new StringBuffer();
                  boolean group = false;
                  for(int i=0; i<replacer.rule.length(); i++){
                      char ch = replacer.rule.charAt(i);
                      if(group){
                          sb.append(matcher.group(Character.digit(ch, 10)));
                          group = false;
                      }else if(ch=='\\')
                          group=true;
                      else
                          sb.append(ch);
                  }
                  return sb.toString();
              }
          }
  
          // Return the original string unchanged
          return word;
      }
docs: /*-------------------------------------------------[ Translate ]---------------------------------------------------