Good time of day. Need to parse the file, the file structure:
D-Date="02.05.2014 16:00:00"&D-NAS-Ident=10.11.81.66:50130&Acct-Status-Type=3&User-Name="ao250_5038202"&Event-Timestamp=1399032000&Acct-Delay-Time=0&NAS-Identifier="RST-E320-1"&Acct-Session-Id="erx TenGigabitEthernet 0/0/0.35042030:3504-2030:0887085679"&NAS-IP-Address=10.11.81.66&Service-Type=2&Framed-Protocol=1&Framed-Compression=0&ERX-Pppoe-Description="pppoe 00:22:b0:eb:d5:57"&Framed-IP.... Pull out D-Date , User-Name , NAS-IP-Address (For example, output D-Date="02.05.2014 16:00:00" )
That's what I managed to write, but refuses to search after the 1st similarity and the structure is not added. I ask for help.
void __fastcall TForm4::Button1Click(TObject *Sender) { if(OpenDialog1->Execute()) { String Text = TFile::ReadAllText(OpenDialog1->FileName); Memo1->Lines->Add(Text); Application->ProcessMessages(); boost::wregex re( L"D-Date=\"(.*?)\"\&" L"User-Name=\"(.*?)\"\&" L"NAS-IP-Address=(.*?)\&"); boost::wcmatch m; if(boost::regex_search(Text.c_str(),m,re)) { for(size_t i=1; i< m.size(); ++i) Memo1->Lines->Add( m[i].str().c_str() ); Application->ProcessMessages(); } }
=sign possible? Are pieces without a sign=possible? Is a shielded=sign possible? Take action. - VladDboost::wregex re(has no relation to the problem. Instead ofMemo2->Lines->Addyou could simply add to the list. AndApplication->ProcessMessages()shows that you do not know how to multithreaded programming (sorry for straightforward). - VladDstrstrandstrchrfor each line. - avp