How to check for any lowercase letters in a string with JavaScript?

Sometimes, we want to check for any lowercase letters in a string with JavaScript.

In this article, we’ll look at how to check for any lowercase letters in a string with JavaScript.

How to check for any lowercase letters in a string with JavaScript?

To check for any lowercase letters in a string with JavaScript, we use a regex.

For instance, we write

const hasLowerCase = (str) => {
  return /[a-z]/.test(str);
};

to call /[a-z]/.test with str to check if str has any lower case letters.

Conclusion

To check for any lowercase letters in a string with JavaScript, we use a regex.