Янковиц,
$(document).on('change keyup input click oninput', 'input', function() {
let pattern = $(this).data( 'pattern' );
if ( pattern !== '' && pattern !== 'undefined' ) {
let [_, pattern , flags] = pattern.split('\/');
this.value = this.value.replace( new RegExp(pattern , flags), '' );
}
});