Assitance with regular expression

Can someone assist with a regular expression for forcing this format? YYYY-MM-DD/XXXXX

The "Xs" are optional, only the "YYYY-MM-DD/" is required, but I need to allow the "Xs"

Thank you.
Who is Participating?

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

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.

nemws1Database AdministratorCommented:
Are the Xs numbers?  If so (assuming perlre):

earwig75Author Commented:
The Xs are optional so it shouldn't matter.
nemws1Database AdministratorCommented:
I ask because it depends on what language you trying to do this regex in.  Perl?  PHP?  Awk?  C#?

A very generic version would be something like this, but it might match too much.  Are there always 5 'X's?


Open in new window

JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

earwig75Author Commented:
Sometimes there are NO Xs, sometimes there are 1 or 2 or 7. I'm using it in javascript. Thank you.
earwig75Author Commented:
So far neither of those seem to be working.
nemws1Database AdministratorCommented:
Try this - I was coding the "/" as optional, but now I see you require it.  I asked if the Xs were numbers because is does matter if I'm using \d, which only matches numbers.  Since you didn't answer, I'm going to assume the X's can be anything.


Open in new window

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
earwig75Author Commented:
Perfect, thank you.
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.