base code for textinput masking