use strict; use warnings; use Test::More tests => 1; my $have = '0x388c818ca8b9251b393131c08a736a67ccb19297'; my $want = '0x388c ... b19297'; $have =~ s/(?<=^.{6}).*(?=.{6}$)/ ... /; is $have, $want;