You can do you regex test against both contexts ^To: and ^From: and
use post_match to reveal the contents after:

http://ruby-doc.org/core-2.0/MatchData.html#method-i-post_match

~Stu