Determine if string is all caps with regular expression

前端 未结 9 870
轻奢々
轻奢々 2020-12-30 00:46

How can you determine if a string is all caps with a regular expression. It can include punctuation and numbers, just no lower case letters.

9条回答
  •  囚心锁ツ
    2020-12-30 01:00

    The string contains a lowercase letter if the expression /[a-z]/ returns true, so simply perform this check, if it's false you have no lowercase letters.

提交回复
热议问题