You can try this regex using lookahead. Lookahead doesn't consume any characters from the input, it just does a check.
First the length including '-' is checked. In this case I set it to max 12 characters.
If the length is ok, then the next expression is tested otherwise it fails.
^(?(?=^[\d\-]{0,12}$)[0-9]\d{2,4}-\d{6,8})$
I hope it helps.
Have a look here for more info.
If-Then-Else Conditionals in Regular Expressions[
^]