I'm working on an input that can only accept
- Numbers
- Letter K (uppercase or lowercase)
- middle script (-)
I have the following regular expression /^[Kk0-9-]+$/
to make only these types of data accepted. What I need is that every time the user types in this input any other data that is not valid is deleted.
I have the event ng-change
function:
$scope.changeRutCliente = function(){
if ($scope.rut_cliente.match(/^[Kk0-9-]+$/)) {
console.log('is valid');
} else {
console.log('invalid');
}
}
But I could not manage to have it delete the invalid data