src/main/java/com/github/ricksbrown/cowsay/CowFormatter.java
public static String formatCow(final String cow, final CowFace face, final Message message) throws CowParseException {
		String result = extractCowTemplate(cow);
		String tongue = face.getTongue();
		String eyes = face.getEyes();
		result = result.replaceAll("\\\\\\\\", "\\\\");  // do this first
		result = result.replace("\\@", "@");
		result = result.replace("\\$", "$");
		result = result.replace("${tongue}", tongue);
		result = result.replace("$tongue", tongue);
		result = result.replace("$thoughts", message.getThoughts());
		result = result.replace("${eyes}", eyes);  // sheep - doesn't help that i know zero perl
		result = result.replace("$eyes", eyes);
		result = result.replaceAll("EOC\\s*$", "");
		result = message.getMessage() + result;
		return result;
	}
public static String formatCow(final String cow, final CowFace face, final Message message) throws CowParseException {
		String result = extractCowTemplate(cow);
		String tongue = face.getTongue();
		String eyes = face.getEyes();
		result = result.replaceAll("\\\\\\\\", "\\\\");  // do this first
		result = result.replace("\\@", "@");
		result = result.replace("\\$", "$");
		result = result.replace("${tongue}", tongue);
		result = result.replace("$tongue", tongue);
		result = result.replace("$thoughts", message.getThoughts());
		result = result.replace("${eyes}", eyes);  // sheep - doesn't help that i know zero perl
		result = result.replace("$eyes", eyes);
		result = result.replaceAll("EOC\\s*$", "");
		result = message.getMessage() + result;
		return result;
	}
Processes the cow template (the raw content of a cowfile) inserting face and message as appropriate.
@param cow The content of a cowfile.
@param face The face to apply to this cow.
@param message The message the cow is saying or thinking.
@return The formatted cow.
@throws CowParseException If the cow could not be parsed.