There may be a better way, but one (rather brute-force) way would be to just check for that particular pattern with a formula.
You'll need ISNUMBER()
to check for numbers*, and you'll need MID(A1,x,1)
to check the character at the xth position in cell A1
.
Combine these with an AND()
and you're good to go.
For the particular example in the OP you can use:
=AND(ISNUMBER(MID(C4,1,1)*1),ISNUMBER(MID(C4,2,1)*1),MID(C4,3,1)="-",ISNUMBER(MID(C4,4,1)*1),ISNUMBER(MID(C4,5,1)*1))
* Checking for numbers in text doesn't work by default. See this SE answer for how to resolve that.