+ given ($opt{simplify} // 'no') {
+ when ('strict') {
+ $header[1] =~ s{
+ \A
+ (?: [^:]+ )?
+ < [^@>]+ (?: @ | \h?\W? at \W?\h? ) [a-z0-9.-]+ >
+ \Z
+ }{<...>}imsx;
+ }
+ when (['text', '']) {
+ when ($header[0] =~ /[ _-] (?: by | to ) $/imsx) {
+ pop @header;
+ }
+ for ($header[1]) {
+ s{\b (https?)://\S+ }{[$1]}gmsx; # url
+ s{(?: < | \A ) [^@>\s]+ @ [^>]+ (?: > | \Z )}{<...>}igmsx; # address
+ s{\b [0-9]+ \b}{[num]}gmsx; # number
+ s{\b I? [0-9a-f]{40} \b}{[sha1]}gmsx; # hash
+ }
+ }
+ when (['all', 'any']) {
+ pop @header;
+ }
+ when ('no') {
+ }
+ default {
+ die "Unknown simplify option: '$_'\n";
+ }
+ }
+
+ if ($opt{'ignore-case'}) {
+ $_ = lc for @header;
+ }
+