$_ = "X1aaX2bbX3heeX4...X5loveU" ; @match = /X\d.+?/g; print "String: " . $_; foreach $word (@match){ print "\n$word"; }