in reply to work with files
You can capture with /(\.c\d+)/ then $len = length($1) gives you the elements you have. To match a certain amount of numbers, just use /\d{$len}/