msibley
asked on
Perl search string, validation
I need a perl search string to validate filenames as I iterate through them.
The filenames should all:
Have 25 characters plus the extension (.xlsx), for example: TESTY_ClinicalQ_20171104.x lsx
First 5 characters: caps alphabetic
underscore
"ClinicalQ" just as it is (first character capital C, then lowercase "linical", then capital Q)
underscore
Then 8 numeric characters
.xlsx
The filenames should all:
Have 25 characters plus the extension (.xlsx), for example: TESTY_ClinicalQ_20171104.x
First 5 characters: caps alphabetic
underscore
"ClinicalQ" just as it is (first character capital C, then lowercase "linical", then capital Q)
underscore
Then 8 numeric characters
.xlsx
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
And this part:
[0-9]{8}
can be abbreviated to:
\d{8}
[0-9]{8}
can be abbreviated to:
\d{8}
And
.
should be
\.
.
should be
\.
And you might like to put a $ near the end like:
xlsx$/
if you want to ensure it matches nothing after that, like:
TESTY_ClinicalQ_20171104.x lsx.old
xlsx$/
if you want to ensure it matches nothing after that, like:
TESTY_ClinicalQ_20171104.x
ASKER