#SingleInstance, Force loc := A_ScriptDir "\data2.txt" file := FileOpen(loc, "r") Loop { If (file.AtEOF) Break data := StrSplit(file.ReadLine(), [A_Tab, A_Space, "-"], " `t:-") ; 1:first number 2:second number 3:letter 4:password reg := "^[^" data[3] "]*(" data[3] "[^" data[3] "]*){" data[1] "," data[2] "}$" StrReplace(data[4],data[3],,test) ; String Replace to get # of LETTER If (test>=data[1] AND test<=data[2]) ; Check if # of LETTER is within the bounds p1++ If ((subStr(data[4], data[1], 1) == data[3])^(subStr(data[4], data[2], 1) == data[3])) ; Please don't make me explain this one p2++ } file.Close() MsgBox % "Part 1: " p1 "`nPart 2: " p2