Patter is a few letters [a-zA-Z] after "photo/" followed by a dot and three [a-z].
#!/usr/bin/perl use strict; use warnings; my $count = 1; open( FILE, $ARGV[0] ); while ( my $w = <FILE> ) { foreach ( $w =~ m/photo\/([a-zA-Z]+\.[a-zA-Z]{3})/g ) { print "Photo: $count $1\n"; $count++; } } $count = $count - 1; print "\nI counted $count image-files\n";
In reply to Regex shows only last match multiple times? by GertMT
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |