I do not think such a plugin is available. The problem is a bit complicated because you have to allow the user to enter some data before applying your regular expression. That is, you cannot just match with each char how it is typed if your regular expression just does not define a character set.
To illustrate, if they enter the payment amount, and you want to allow numbers and decimals based on a single character, what prevents them from entering 99.99.23.42492 ?
On the other hand, if you supply a full regular expression, for example /\d+\.\d{2}/ , then it will not match at all on one character, you will have to allow them to enter a number of characters before trying to apply regex and destroy enter them if it does not match. It can be frustrating.
If you really want to filter the input when you enter it, then you want to allow a digit for the first character, then digits or decimal numbers for subsequent characters until you enter the decimal digit, and then two more digits, and then there is no more input. This is not a general purpose filter.
For example, there is code that will do this, but it is very ugly.
myInput.keydown(function() { var text = this.val if(!/^\d/.test(text)) { return ''; } else { done = text.match(/^(\d+\.\d\d)/); if (done) { return done[0]; } last_char = text.substr(text.length-1,1); decimal_count = text.replace(/[^\.]/g,'').length; if (decimal_count < 1) { if (!/[\d\.]/.test(last_char)) { return text.substr(0,text.length-1); } } else if (decimal_count == 1 && last_char == '.') { return text; } else { if (!/[\d]/.test(last_char)) { return text.substr(0,text.length-1); } } return text; } });
And, of course, this will not work if they insert certain values ββwithout doing a βrealβ typing.
Maybe some other approach will work better for you? Like highlighting a field and telling the user if they enter non-digital, not decimal, or if they enter more than one decimal place, rather than filtering the input itself, because it seems messy.