You can configure on change/Key press event with run script action. In the JS function write a logic to restrict the number of character entries and the type of characters which are valid for the text input. You may use the below kinda script to achieve the "only numeric character" use-case.
var numbers = /^[0-9]+$/;
alert('Your Registration number has accepted....');