How to create this pattern

First this is for Java usage.

I am trying to create a pattern to match any string to have the format ddd-dd-ddd first 10 characters and it can or cannot have any character or characters followed. In the pattern said above :
d = digit
-  = hyphen (it is a fixed character)
Example strings this pattern should match:
345-11-333
453-22-4332
233-44-222g
334-53-223*7kjkjd

etc.
prainAsked:
Who is Participating?
 
CEHJCommented:
"\\d{3}-\\d{2}-\\d{3}.*" should be OK
0
 
prainAuthor Commented:
Thanks. That's what I missed in my attempts - the . (dot).
0
 
CEHJCommented:
:)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.