|
Boost Users : |
From: Aries Tao (tao_at_[hidden])
Date: 2008-01-20 10:03:01
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.
http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net