var pattern =/[a-zA-Z]/g var newValue="aaa" if(!pattern.test(newValue)){ alert("Error: Only alphabets allowed"); }
Regex to allow alphabets only JavaScript
admin Changed status to publish December 26, 2023
var pattern =/[a-zA-Z]/g var newValue="aaa" if(!pattern.test(newValue)){ alert("Error: Only alphabets allowed"); }