Regular Expression

I need to write a regular expression that matches the following string

the start of the string has ASC and then it could have any letters from a-zA-Z followed by .xls

example ASCRegions.xls , ASCfaculties.xls, ASCContracts.xls
LVL 1
countrymeisterAsked:
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.

silemoneCommented:
ASC(.)*\.xls
0
ddrudikCommented:
0 or more:
^ASC[a-zA-Z]*\.xls$
1 or more:
^ASC[a-zA-Z]+\.xls$
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
silemoneCommented:
(ASC)[a-zA-Z]+\.xls...
0
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Fernando SotoRetiredCommented:
Hi countrymeister,

This regex pattern should do it.

String pattern = @"(^ASC[a-zA-Z]+\.[xX][lL][sS])";

Regards,
Fernando
0
silemoneCommented:
my first submission:  takes into account all letters with (.)*, but also takes into account other characters such as numbers, etc...incase they are part of the name...

my second submission only takes into consideration and says there must be at least 1 character...and disreqard the '...'  its a habit...

also as ddrudik stated, I should have ^at the front and $ at the end...for beginning and end of line...
0
silemoneCommented:
well actually should be:

Regex reg = new Regex("^(ASC)[a-zA-Z]+\.xls$");

reg.Match("TextToCompare");
0
ddrudikCommented:
Thanks for the question and the points.
0
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
Regular Expressions

From novice to tech pro — start learning today.