The following c++ example will average about 15-30 milisecs.
Plain Text
#include "stdafx.h" #include <iostream> #include <fstream> #include <string> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { string line; size_t found; ifstream myfile ("C:/Users/xxx/xxx/xxx/x/c++examples/io/iotexst/iotexst/file.xml"); if (myfile.is_open()) { while ( myfile.good() ) { getline (myfile,line); found = line.find("something that cant be found so we put a real test"); if (found!=string::npos) cout << "first 'name' found at: " << int(found) << endl; } myfile.close(); } else cout << "Unable to open file"; return 0; //return 0; }
But what is most interesting of all that on the same file readed into string while using if StringRegexp(readed_text, "substr",0) the average time to finish will be 3-8 milisecs!
My first guess is that stringregexp is actually that faster because of the way it figures out that the text cant be found by first trying to match the starting chars of the substring.
Edited by Aktonius, 02 July 2012 - 05:44 PM.





