Currently I write the regex like this: /^([\\d+]*-)+([\\d]*-)+([\\d])*$/
I want the result follow this pattern 00-123-456-789 or 0012
If I understand you correctly, you wish your regex to stand for strings which consist of a number group followed (optionally) by additional number groups with a - separator.
\d+ # represents a number group
(-\d+)* # represents 0 or more additional number groups beginning with "-"
So, together with the necessary beginning and end of line assertions, together we have:
^\d+(-\d+)*$