fork(2) download
  1. #include <iostream>
  2. #include <string>
  3. #include <regex>
  4.  
  5. int main()
  6. {
  7. std::string main2="\"[a-zA-Z_0-9-]+\"\\s*:\\s*";
  8. std::string dig="[0-9]*1[0-9]*";
  9. std::string phrase="\"[a-zA-Z_0-9:\\s,./=;-]*1[a-zA-Z_0-9:\\s,./=;-]*\"";
  10.  
  11. std::string format_1=main2+"("+dig+"|"+phrase+")";
  12. std::string str("\"dataStoreMaxConns\" : 100,\n\"dataStoreName\" : \"cofax\",\n\"dataStorePassword\" : \"dataStoreTestQuery\",\n\"dataStoreTestQuery\" : \"SET NOCOUNT ON;select test='test';\",\n\"dataStoreUrl\" : \"jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon\"");
  13. std::regex f_1(format_1,std::regex_constants::icase);
  14.  
  15. std::smatch m_1;
  16. for(auto it = std::sregex_iterator(str.begin(), str.end(), f_1);it != std::sregex_iterator();++it)
  17. {
  18. std::cout<<it->str()<<std::endl;
  19. }
  20. return 0;
  21. }
Success #stdin #stdout 0s 15344KB
stdin
Standard input is empty
stdout
"dataStoreMaxConns" : 100
"dataStoreUrl" : "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon"