/SwitchWildcardRegex.ps1 Secret
Created
June 23, 2020 23:21
Star
You must be signed in to star a gist
Switch z Wildcard i Regex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch -Wildcard ('cośtam') { | |
*tam { | |
'Pasuje' | |
} | |
coo* { | |
'Nie pasuje' | |
} | |
} | |
# Na wyjściu: "Pasuje" | |
switch -Regex ('dwa słowa') { | |
^d { | |
'zaczyna sie od "d"' | |
} | |
a$ { | |
'kończy się na "a"' | |
} | |
\d { | |
'zawiera cyfry' | |
} | |
} | |
# Na wyjsciu: "zaczyna się od d" oraz "kończy się na a" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment