Determine if string is all caps with regular expression

前端 未结 9 985
轻奢々
轻奢々 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 00:58

    Why not just use if(string.toUpperCase() == string)? ._. Its more "elegant"...
    I think you're trying to force in RegExp, but as someone else stated, I don't think this is the best use of regexp...

提交回复
热议问题