Think about Loose Coupling | |
PerlMonks |
Re: Extracting datapart (YYYYMMDD) with filename regular expressionby Laurent_R (Canon) |
on Dec 01, 2016 at 23:08 UTC ( [id://1177091]=note: print w/replies, xml ) | Need Help?? |
For the file names you've shown, a simple regex looking for 8 digits will do it:
Now, assuming you are not going to look for Apache logs dating from the twentieth century and that your program is likely to be obsolete in the 22nd century, you could narrow down the search: or narrow it down even further with something like this (untested): (Of course, it is up to you to add capturing parentheses if you need.)
In Section
Seekers of Perl Wisdom
|
|