Amith Amith - 1 month ago 14
Javascript Question

regular expression in javascript which allows backspace

My regular expression which allows characters, numbers, dot and underscore is

var numericReg = /^[a-zA-Z0-9\._]+$/;


How could i allow backspace in this reg ex.?

Answer

The optimal solution for this problem is to check the value of textbox >0 before validating. This will help to solve error showing while pressing backspace in an empty textbox..!!

Comments