regex for upper case and lower case string validation in javascript code example
Example 1: regex only uppercase letters js
if (value.match(/^[A-Z]*$/)) {
// matches
} else {
// doesn't match
}
Example 2: regex for lowercase letters js
function hasLowerCase(str) {
return (/[a-z]/.test(str));
}