Last active
December 12, 2015 06:48
-
-
Save jamessantiago/4731468 to your computer and use it in GitHub Desktop.
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
$a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
$ToTest = { | |
"AAAAAAA" | |
"AAAAAAAA" | |
"AAAAAAAAA" | |
"AAAAAAAAAA" | |
"AAAAAAAAAAA" | |
"AAAAAAAAAAAA" | |
"AAAAAAAAAAAAA" | |
"AAAAAAAAAAAA" | |
"AAAAAAAAAAA" | |
"AAAAAAAAAA" | |
"AAAAAAAAA" | |
"AAAAAAAA" | |
"AAAAAAA" | |
} | |
function GetNextString ($current) { | |
$x = ConvertStringToInt $current | |
$x ++ | |
ConvertIntToString $x | |
} | |
function ConvertStringToInt ($string){ | |
$result = ""; | |
$string.ToCharArray() |% { | |
if ($_ -eq "A") {$result += "11111"} else | |
{ $result += [convert]::ToString(([byte]$a.IndexOf([string]$_)), 2).PadLeft(5, '0') } | |
} | |
[convert]::ToInt32($result, 2) | |
} | |
function ConvertIntToString ($number){ | |
$result = "" | |
$bin = [convert]::ToString($number, 2) | |
for ($i = 0; $i -lt $bin.Length; $i += 5) | |
{ | |
$sub = $bin.Substring($i, 5) | |
if ($sub -eq "11111") {$result += "Z"} else | |
{$result += $a[[convert]::ToInt32($sub, 2)]} | |
} | |
$result | |
} | |
$ToTest |% { | |
} | |
"|ET|IN)[^X]*" | |
"(DI|NS|TH|OM)*" | |
".*(IN|SE|HI)" | |
"[CHMNOR]*I[CHMNOR]*" | |
"C*MC(CCC|MM)*" | |
"([^EMC]|EM)*" | |
"[CEIMU]*OH[AEMOR]*" | |
"[AM]*CM(RC)*R?" | |
"N.*X.X.X.*E" | |
".*XHCR.*X.*" | |
"(RR|HHH)*.?" | |
"(...?)\1*" | |
".*XEXM*" | |
"[CR]*" | |
"[^C]*MMM[^C]*" | |
"(E|CR|MN)*" | |
"([^X]|XCC)*" | |
".*OXR.*" | |
".*PRR.*DDC.*" | |
"R*D*M*" | |
".*(.)(.)(.)(.)\4\3\2\1.*" | |
"(RX|[^R])*" | |
".*SE.*UE.*" | |
".*LR.*RL.*" | |
"(S|MM|HHH)*" | |
".*G.*V.*H.*" | |
"[^C]*[^R]*III.*" | |
"(HHX|[^HX])*" | |
".(C|HH)*" | |
".*DD.*CCM.*" | |
"P+(..)\1.*" | |
"(O|RHH|MM)*" | |
"([^MC]|MM|CC)*" | |
".*(.)C\1X\1.*" | |
"F.*[AO].*[AO].*" | |
"[^M]*M[^M]*" | |
".*H.*H.*" | |
".*" | |
".*" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
don't look at this