Constraint on inputs

Constraint on inputs

I have created fields on the form for user input. However i would like the input to only be valid if it is in the form of three numbers followed by a verticle slash then three other numbers. eg 279|587

And to deny input using front or back slashes eg 279/578 or 279\578

Is this possible?