Question : PowerShell Verify if Paramater Substring is Between A and Z

I am trying to build a PowerShell script that checks the 5th character in a paramter and checks to see if it is letter in the alphabet between A and Z. However, I am not sure how to check for that.

This is what I have so far... but it doesn't work...
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
# Check for Alpha
 
$nameone = P1234W1054 
 
IF ($nameone.Substring(5,1) -eq "[a-z]"
{
  "Is in the alphabet"
}
else
{
  "Not in the Alphabet"
}
Open in New Window Select All

Answer : PowerShell Verify if Paramater Substring is Between A and Z

Try
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
# Check for Alpha
 
$nameone = "P1234W1054"
 
if ($nameone.Substring(5,1) -match "[a-z]"
{
  "Is in the alphabet"
}
else
{
  "Not in the Alphabet"
}
Open in New Window Select All
Random Solutions  
 
programming4us programming4us