perl -e ' my $string = "an apple in the fridge"; $string =~ /(apple in the fridge|an apple)/; print $1 . "\n"; ' an apple