use strict; use warnings; # Small standalone test program derived from [id://11153804] # @lines contains some test lines derived from: # https://www.sec.gov/Archives/edgar/data/831001/000095010323011632/0000950103-23-011632.txt my @lines = ( 'dp198076_424b2-us2342673.htm', 'dp198076_exfilingfees.htm', 'dp198076_oopswrongextension.htmfred', ); foreach my $line (@lines) { print "line:$line:\n"; if ($line =~ m/(.*\.htm)/) { print " matched line: filename='$1'\n"; } else { print " did not match line\n"; } } #### line:dp198076_424b2-us2342673.htm: matched line: filename='dp198076_424b2-us2342673.htm' line:dp198076_exfilingfees.htm: matched line: filename='dp198076_exfilingfees.htm' line:dp198076_oopswrongextension.htmfred: matched line: filename='dp198076_oopswrongextension.htm' #### if ($line =~ m/(.*\.htm)/) { #### if ($line =~ m/(.*\.htm)\b/) { #### line:dp198076_424b2-us2342673.htm: matched line: filename='dp198076_424b2-us2342673.htm' line:dp198076_exfilingfees.htm: matched line: filename='dp198076_exfilingfees.htm' line:dp198076_oopswrongextension.htmfred: did not match line