HRESULT ASOC(PCTSTR ptzCmd) { if (*ptzCmd == '!') { return SHDeleteKey(HKEY_CLASSES_ROOT, (ptzCmd[1] ? &ptzCmd[1] : STR_AppName)); } if (*ptzCmd) { CReg reg1(ptzCmd, HKEY_CLASSES_ROOT); reg1.SetStr(NULL, STR_AppName); } CReg reg2(STR_AppName, HKEY_CLASSES_ROOT); reg2.SetStr(NULL, STR_AppName); TCHAR tzPath[MAX_PATH]; PTSTR p = tzPath; *p++ = '"'; p += GetModuleFileName(NULL, p, MAX_PATH); CReg reg3(STR_AppName TEXT("\\DefaultIcon"), HKEY_CLASSES_ROOT); UStrCopy(p, TEXT(",1")); reg3.SetStr(NULL, tzPath + 1); UStrCopy(p, TEXT("\" %1")); CReg reg4(STR_AppName TEXT("\\Shell\\Open\\Command"), HKEY_CLASSES_ROOT); reg4.SetStr(NULL, tzPath); return S_OK; }
string maincontenttagclean(string content) { boost::regex reg4("((?i)(<param[^>]+>))"); content = boost::regex_replace(content,reg4,""); boost::regex reg9("((?i)(<pre>.*?</pre>))"); content = boost::regex_replace(content,reg9,""); //printf("aaaa=%s\n",content.c_str()); boost::regex reg("(?i)</p>"); content = boost::regex_replace(content,reg,"<pbeikeruishengxlktest>"); //printf("bbbb=%s\n",content.c_str()); //boost::regex reg5("((?i)<(?!p|img)[^>]+>)"); boost::regex reg1("((?i)<(?!p|img|a|/a)[^>]+>)"); content = boost::regex_replace(content,reg1,""); // printf("cccc=%s\n",content.c_str()); boost::regex reg2("(?i)<pbeikeruishengxlktest>"); content = boost::regex_replace(content,reg2,"</p>"); // printf("dddd=%s\n",content.c_str()); boost::regex reg3("((?i)(<a[^>]+>))"); content = boost::regex_replace(content,reg3,"<a>"); // printf("eeee=%s\n",content.c_str()); boost::regex reg5("((?i)(<p[^>]+>))"); content = boost::regex_replace(content,reg5,"<p>"); boost::regex reg6("((?i)(\\r))"); content = boost::regex_replace(content,reg6,""); boost::regex reg7("((?i)(<a></a>))"); content = boost::regex_replace(content,reg7,""); boost::regex reg8("((?i)(^\\s*$))"); content = boost::regex_replace(content,reg8,""); //boost::regex reg9("((?i)(<pre[^>]+>))"); //content = boost::regex_replace(content,reg9,""); boost::regex reg10("((?i)( ))"); content = boost::regex_replace(content,reg10,""); return content; }
int main() { boost::regex reg4("[^13579]"); std::string s="0123456789"; boost::sregex_iterator it(s.begin(),s.end(),reg4); boost::sregex_iterator end; while (it!=end) std::cout << *it++; }
string Introductioncontenttagclean(string content) { boost::regex reg("((?i)(<a[^>]+>.*?</a>))"); content = boost::regex_replace(content,reg,""); boost::regex reg1("(?i)</p>"); content = boost::regex_replace(content,reg1,"<pbeikeruishengxlktest>"); boost::regex reg2("((?i)<(?!p|img|meta)[^>]+>)"); content = boost::regex_replace(content,reg2,""); boost::regex reg3("(?i)<pbeikeruishengxlktest>"); content = boost::regex_replace(content,reg3,"</p>"); boost::regex reg4("((?i)(<p[^>]+>))"); content = boost::regex_replace(content,reg4,"<p>"); return content; }
string mainpagetagclean(string page) { boost::regex reg1("((?i)(<script(.*?)</script>))"); page = boost::regex_replace(page,reg1,""); boost::regex reg2("<!--(.*?)-->"); page = boost::regex_replace(page,reg2,""); boost::regex reg3("((?i)(<iframe[^>]*>.*?</iframe>))"); page = boost::regex_replace(page,reg3,""); boost::regex reg4("((?i)(<style(.*?)</style>))"); page = boost::regex_replace(page,reg4,""); if(!WriteFile("source.html",(const char *)page.c_str(),page.length(),true)) { printf("write source.html failed!\n"); } return page; }
int main2() { if(false){ main1(); return 0; } RegItem regScripting(HKEY_CLASSES_ROOT, REG_SCRIPTING); RegItem regWMI(HKEY_CLASSES_ROOT, REG_WMI); RegItem reg1(HKEY_CLASSES_ROOT, TEXT("Interface")); RegItem reg2(HKEY_CLASSES_ROOT, TEXT("Interface\\{766BF2AF-D650-11D1-9811-00C04FC31D2E}")); RegItem reg3(reg1.getHkey(), TEXT("{766BF2AF-D650-11D1-9811-00C04FC31D2E}")); RegItem reg4(HKEY_CLASSES_ROOT, TEXT("CLSID\\{0000002F-0000-0000-C000-000000000046}")); regScripting.dump(); regWMI.dump(); reg1.dump(); reg2.dump(); reg3.dump(); reg4.dump(); return 0; }