Skip to content

Instantly share code, notes, and snippets.

@bielawb
Created June 23, 2020 23:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bielawb/bf6ed1d9de78afa61a230a4dee8e5c81 to your computer and use it in GitHub Desktop.
Switch z Wildcard i Regex
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