use Regexp::Exhaustive 'exhaustive'; my @matches = exhaustive( 'asdf' => qr/..??/, qw[ $` $& $' ], ); printf "%s<%s>%s\n", @$_ for @matches; __END__ sdf df adf af asf as asd