It depends on which element tag you are using.
If you are using , then you can use the pattern attribute and regex.
I am a bit confused as to what you want exactly; however, here is an example of how to only accept a number like 123-45678-9 in that exact format of 3 numbers then a dash the 5 numbers then a dash and then one number.
[0-9]{3}-[0-9]{5}-[0-9]{1}
This says it will accept any number, the [0-9], for the first 3 spots, {3} with the first number being the minimum and a potential second number being the maximum number of consecutive numbers, then a dash, -, and so on with those rules changing slightly with {5} and {1}.
However, if you only want to include dashes and numbers in your input, you could just use the following regex: "[0-9]|-"
In the end your solution might look something like:
If you are using , there is no pattern attribute you an apply to the element and you will have to use javascript to restrict what type of input pattern to accept.