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
msibleyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NorieAnalyst Assistant Commented:
Perhaps you could use this pattern.

m/^[A-Z]{5}_ClinicalQ_[0-9]{8}.xlsx/

For example.
$test = "TESTY_ClinicalQ_20171104.xlsx";

$check =$test=~m/^[A-Z]{5}_ClinicalQ_[0-9]{8}.xlsx/ ;

if($check){
    print("Match");
}
else
{
    print("No match");
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
msibleyAuthor Commented:
Another REGEX wizard to the rescue! Thanks!
0
tel2Commented:
And this part:
    [0-9]{8}
can be abbreviated to:
    \d{8}
1
ozoCommented:
And  
  .
should be
 \.
1
tel2Commented:
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
1
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Perl

From novice to tech pro — start learning today.