Skip to content

Instantly share code, notes, and snippets.

@HumanEquivalentUnit
Created April 22, 2020 07:16
Show Gist options
  • Save HumanEquivalentUnit/406d4ddb565b1f1f1f5fd817c0d63eae to your computer and use it in GitHub Desktop.
Save HumanEquivalentUnit/406d4ddb565b1f1f1f5fd817c0d63eae to your computer and use it in GitHub Desktop.
$keys = @{
'1'='' ; '2'='[abc]'; '3'='[def]' ;
'4'='[ghi]' ; '5'='[jkl]'; '6'='[mno]' ;
'7'='[pqrs]'; '8'='[tuv]'; '9'='[wxyz]';
}
$nums = '76937'
$pattern = foreach ($char in $nums.GetEnumerator())
{
$keys["$char"]
}
$pattern = "^$($pattern -join '')$"
$pattern
$words = [IO.File]::ReadAllLines('C:\path\to\wordlist.txt')
$words -match $pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment