Here is a new Powershell tip to detect if a string contains Uppercase (all characters or some characters only):

Use case1: check if the string contain at least one character in uppercase !

ex:

$var= “Shubam.Bailay”

if ($var -cmatch “[A-Z]” {write-host “it contains characters in uppercase”} else {write-host “all is in lowercase”}

Use case2: check if the string contain ALL characters in uppercase !

ex:

$var= “SHUBMANBAILAY”

if ($var -cmatch “^[A-Z]*$” {write-host “it contains all characters in uppercase”} else {write-host “all is in lowercase”}