hi everybody,I use boost.xpressive to search email address in a binary file which size is 10*1024*1024 bytes. every bytes is 0x6f in that file.boost.xpressive is inefficient. anyone can help me? thanks!
the code is below:
 
    //read file
    CFile file(_T("d:\\test.dat"),CFile::modeRead );
    byte* pBuffer = new byte[file.GetLength()];
    file.Read(pBuffer,file.GetLength());
 
 
    std::string str((char*)pBuffer,file.GetLength());  
 
    sregex token = sregex::compile("([a-z#~_\\.!\\#$%\\^&\\*\\(\\)\\-]+@[a-z#_\\-]+\\.[a-z#_\\-\\.]+)");
    sregex_iterator cur( str.begin(), str.end(), token );
    sregex_iterator end;
    for( ; cur != end; ++cur )
    {
       smatch const &what = *cur;
       std::string strResult = what[0];
       int start = what[0].first - str.begin();
    }

 


Helping your favorite cause is as easy as instant messaging. You IM, we give. Learn more.