private static String extractCowTemplate ( final String cow ) throws CowParseException { Matcher matcher = COWSTART_RE . matcher ( cow ) ; if ( matcher . find ( 0 ) ) { String result = matcher . replaceFirst ( "" ) ; return result ; } else { throw new CowParseException ( "Could not parse cow " + cow ) ; } }
Extracts the ascii art part of the cowfile removing any before or after PERL comments variable assignments weird EOC markers etc .