http://www.perlmonks.org?node_id=729487


in reply to Regex To Remove File Extension

I know your title asks for a regex, but maybe split will do:
use strict; use warnings; while (<DATA>) { chomp; my @parts = split /\./; pop @parts; my $file_no_ext = join '.', @parts; print "file_no_ext = $file_no_ext\n"; } __DATA__ foo.bar.txt goo.doc boo.hoo.moo

prints:

file_no_ext = foo.bar file_no_ext = goo file_no_ext = boo.hoo