I would like to check few of my text boxes that must satisfy the following conditions: Alphabets i meant are from a-z(uppercase and lower case) numbers 0-9 and special characters are ~`!@#$%^&*()-_+={}[];:'",.<>/?
- It can contain only alphabets
- It cannot contain only numbers
- It cannot contain only special characters
- It cannot contain only numbers and special characters
- It can contain alphabets,numbers and special characters
- It can contain alphabets and numbers
- It can contain alphabets and special charcters
I found a solution but seems not working for me:
/^[a-z0-9/. -!@#$%^&*(){}:;"',/?]+$/i I am checking it as:
var alpha=/^[a-z0-9/. -!@#$%^&*(){}:;"',/?]+$/i; if (!alpha.test(username.value)) { alert('Invalid username'); document.theForm.username.focus(); return false; }
\p{L}to pick up any Unicode letter; to do that in JavaScript is beyond tedious. What do you mean by "alphabets"?