my $line = "P1::Va=Wb,P2::Vc=Wd,P1::Ve=Wf,P3::Vx=Wy,"; my @comps = $line =~ m{\w+::\w+=(?:[^,]|,\d)*}g;