How to write regex for any character in Java?

How can I write a regex for the following string:

Originally I used to have this kind of a string:
20131009_1333_36_check_standards_ALL_Files.xml

Open in new window


And this was the regex i was using:
\\d{8}_\\d{4}_\\d{2}_check_standards_ALL_Files.xml

Open in new window



But now, I need to change the input string as the following:

20131009_1333_36_abcdef_234_rtgh_check_standards_ALL_Files.xml

Open in new window



The following piece changes for every case:

abcdef_234_rtgh

Open in new window


The changing part can include any character.

Now, my question is how can I change my original regex so that it will match the new string?
TolgarAsked:
Who is Participating?
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.

CEHJCommented:
Try
"\\d{8}_\\d{4}_\\d{2}_\\w*?check_standards_ALL_Files.xml

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
CEHJCommented:
:)
Bear in mind that will break if any character other than a-z A-Z 0-9 and _ is used for your 'wild' bit
0
TolgarAuthor Commented:
So, what is the best thing to do if I need to cover characters like minus (-) or plus (+) or %. In general what is the safest wild bit that would cover everything?
0
CEHJCommented:
Well you'd really need to change \\w to . (the dot)
0
TolgarAuthor Commented:
ok. Thanks!
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
Java

From novice to tech pro — start learning today.