To help us communicate without going around in circles, please read and try to follow:
Here is my test program t1.pl:
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/00 +00950103-23-011632.txt my @lines = ( '<FILENAME>dp198076_424b2-us2342673.htm', '<FILENAME>dp198076_exfilingfees.htm', '<FILENAME>dp198076_oopswrongextension.htmfred', ); foreach my $line (@lines) { print "line:$line:\n"; if ($line =~ m/<FILENAME>(.*\.htm)/) { print " matched line: filename='$1'\n"; } else { print " did not match line\n"; } }
When I run this program, this is what I see:
line:<FILENAME>dp198076_424b2-us2342673.htm: matched line: filename='dp198076_424b2-us2342673.htm' line:<FILENAME>dp198076_exfilingfees.htm: matched line: filename='dp198076_exfilingfees.htm' line:<FILENAME>dp198076_oopswrongextension.htmfred: matched line: filename='dp198076_oopswrongextension.htm'
When I change this line above from:
to:if ($line =~ m/<FILENAME>(.*\.htm)/) {
if ($line =~ m/<FILENAME>(.*\.htm)\b/) {
when I run this program I see instead:
line:<FILENAME>dp198076_424b2-us2342673.htm: matched line: filename='dp198076_424b2-us2342673.htm' line:<FILENAME>dp198076_exfilingfees.htm: matched line: filename='dp198076_exfilingfees.htm' line:<FILENAME>dp198076_oopswrongextension.htmfred: did not match line
If that is not what you were asking about, please clarify your question by posting a Short, Self-Contained, Correct Example that we can run.
In reply to Re^3: pattern matching once
by eyepopslikeamosquito
in thread pattern matching once
by justin423
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |