use strict;
my $str = 'S03E01.Initiation.mkv
S03E02.For.the.Man.Who.Has.Everything.mkv
S03E03.Kids\'.Stuff.mkv
S03E04.Hawk.and.Dove.mkv
S03E05.This.Little.Piggy.mkv
S03E07.The.Return.mkv
S03E08.The.Greatest.Story.Never.Told.mkv
S03E09.Ultimatum.mkv
S03E10.Dark.Heart.mkv
S03E11.Wake.the.Dead.mkv
S03E12.The.Once.and.Future.Thing.Part.1.Weird.Western.Tales.mkv
S03E13.The.Once.and.Future.Thing.Part.2.Time.Warped.mkv
';
my $regex = qr/(?<!E\d{2})\.(?!\w+$)/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html