in reply to Manipulating the Capture(s) of Regular Expressions
$text =~ s{cow\s+\K(\w+)(?=\s+over)} {do_action($1); calculate_new_action($1)}e; [download]