use strict ; use warnings ; use Data::Dumper ; my $str = "abcdef" ; $str =~ /(?[ab])*(?c)(?d)(?[ef]*)/ ; print Dumper(\%-) ;