i want to validate a input by regex. if user enter any character with in a to z or A to Z then it will not accepted but if user enter + sign or bracket or any digit then it will be accepted. i use the regex but it did not work as per my requirement.
var regEx = '/^[A-Za-z]*$/';
if (flag) {
var val = jQuery.trim($("input[id*='txtfphone']").val())
if (val.match(regEx)) {
if (_AdjustHeight == 0) {
$(".ui-dialog").animate({ height: '+=' + dialog_loader.height + 'px' }, 600, function () {
_AdjustHeight = 1;
$('#feed_loader').fadeIn('slow').html('<span>' + dialog_Msg.Invalid_Phone + '</span>');
$("input[id*='txtfphone']").focus()
});
}
else if (_AdjustHeight == 1) {
$('#feed_loader').fadeOut('slow', function () {
$('#feed_loader').html('<span>' + dialog_Msg.Invalid_Phone + '</span>');
}).fadeIn('slow');
$("input[id*='txtfphone']").focus()
}
flag = false;
return false;
}
}
so help me with right regex. it will be accepted if user enter data like
+913325806589
+91 33 25806589
913325806589
91 33 25806589
91 (33) 25806589
+91 (33) 25806589
but if user enter any alphabet as a input then it will not be accepted. like
aaab
+a913325806589
+91332a5806589
+91332a5806589b etc
a to z any character will not be accepted. thanks