Link to home
Create AccountLog in
Avatar of msibley
msibleyFlag for United States of America

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.xlsx
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
Avatar of Norie
Norie

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of msibley

ASKER

Another REGEX wizard to the rescue! Thanks!
And this part:
    [0-9]{8}
can be abbreviated to:
    \d{8}
And  
  .
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.xlsx.old