I have been struggling with this for an embarrassingly long time so I have come here for help.
I want to match all strings that have a number followed by an optional dash followed by more numbers.
Example:
#Match
1
34-1
2-5-2
15-2-3-309-1
# Don't match
1--
--
#$@%^#$@#
dafadf
10-asdf-1
-12-1-
I started with this regex (one or more digits, followed optionally by a dash and one and more digits):
\d+(-\d+)*
That didn't work. Then I tried parenthesizing around the \d:
(\d)+(-(\d)+)*
That didn't work either. Can anybody help me out?



1--,10-asdf-1, and (maybe)-12-1-as "Don't Match', but at least the first two definitely match your text description, as well as the regex. The regex does match your text description, but not apparently what you really want.