I have the following code in Titanium to check if user input is non-numeric:
textBox.addEventListener('change', function (e) {
var patt = new RegExp('^\d+(\.\d{1,2})?$','gi');
if (e.value.match(patt) != null) {
//insert action here
}
});
I personally would like to delete non-decimal characters when a user tries to input one. However, in order to do so, I would need to use replace(inversePatt, "")
. I would like to know, how do I get the inverse of my regular expression?