String operators -like and -match

Some short examples on how you can use string operators -like and -match

1
2
3
4
5
6
7
8
9
10
11
# Wildcards
"PowerShell" -like "Power*"
"PowerShell" -like "bash*"
"PowerShell" -like "?owerShell"  # question marks work for single characters
"PowerShell" -like "Power*[s-v]" # ends in a char between s and v
"PowerShell" -like "Power*[a-c]" # ends in a char between a and c

# Regular Expressions
"123-345-6789" -match "[0-9]{3}-[0-9]{3}-[0-9]{4}"  
"ABX-345-6789" -match "[0-9]{3}-[0-9]{3}-[0-9]{4}"  
"123.345.6789" -match "[0-9]{3}-[0-9]{3}-[0-9]{4}"