added feature to validate each char typed on keypress and fixed the regex feature