Regex To Check If A String Is All Uppercase (Or Lowercase)

Category: Strings

A regular expression to check if a string is all uppercase (or lowercase) letters.

Uppercase

/^[^a-z]*$/

Matches:

  • REGEX
  • REGEXPATTERN
  • ABCD

Non-Matches:

  • regex
  • regexpattern
  • RegexPattern

Lowercase

/^[^A-Z]*$/

Matches:

  • regex
  • regexpattern
  • RegexPattern

Non-Matches:

  • REGEX
  • REGEXPATTERN
  • ABCD

See Also:

Rate This Regex
Sending
User Review
0 (0 votes)

Expression Flags

Flags Description
i Ignore case sensitive.
g Allows global search.
m Allows multiline search.