int counter=0; int counter2=0; regex MyRegex("123456$"); string ligne; ifstream file("10-million-combos.txt" ); if (file.is_open()) { while (getline(file,line)) { ++counter; if(regex_search(line,MyRegex)) { ++counter2; } } #### RegexObj := TRegExpr.Create; RegexObj.Expression := '123456$'; reset(tfIn); while not eof(tfIn) do begin readln(tfIn, s); if RegexObj.Exec(s) then counter2:=counter2+1; counter:=counter+1; end; #### $f = [System.IO.File]::OpenText("10-million-combos.txt") while (! $f.EndOfStream) { $line = $f.ReadLine(); if ($line -match "123456$" ) { $counter +=1 } $counter2+=1 } #### with open("10-million-combos.txt", encoding="cp850") as infile: for line in infile: counter2 += 1 if re.search('123456$', line): counter += 1 #### open("10-million-combos_LF.txt") do |content| content.each_line do |line| counter=counter+1 if line.match(/123456$/) counter2 += 1 end end end #### Dim mStreamReader As StreamReader = New StreamReader("10-million-combos.txt") line = mStreamReader.ReadLine() Do While (line IsNot Nothing) counter += 1 If Regex.IsMatch(line, "123456$") Then counter2 += 1 line = mStreamReader.ReadLine() Loop #### Set objTextFile = objFSO.OpenTextFile("10-million-combos.txt", ForReading) Set objRegEx = CreateObject("VBScript.RegExp") objRegEx.Pattern = "123456$" Count=0 Count2=0 Do Until objTextFile.AtEndOfStream Count2=Count2+1 strNextLine = objTextFile.ReadLine Set colMatches = objRegEx.Execute(strNextLine) Count=Count+colMatches.Count Loop #### Regex rgx = new Regex("123456$"); int counter = 0; int counter2 = 0; using (StreamReader sr = new StreamReader(@"10-million-combos.txt")) { String line; while ((line = sr.ReadLine()) != null) { ++counter; if (rgx.IsMatch(line)) { ++counter2; } } } #### $counter=0; $counter2=0; $handle = fopen("10-million-combos.txt", "r"); while (($line = fgets($handle)) !== false) { ++$counter; if(preg_match('/123456\R$/',$line)) { ++$counter2; } } #### String line; Pattern p = Pattern.compile("123456$"); String fichier ="10-million-combos.txt"; InputStream ips=new FileInputStream(file); InputStreamReader ipsr=new InputStreamReader(ips); BufferedReader br=new BufferedReader(ipsr); while ((line=br.readLine())!=null){ m = p.matcher(line); if (m.find()) {count2+=1;} count+=1; }