Punchcard

MF regex

Oct 8th, 2023
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | Source Code | 0 0
  1. #include <cassert>
  2. #include <filesystem>
  3. #include <fstream>
  4. #include <iostream>
  5. #include <regex>
  6. #include <sstream>
  7. #include <string>
  8. #include <vector>
  9.  
  10. using namespace std;
  11. using filesystem::path;
  12.  
  13. path operator""_p(const char* data, std::size_t sz) {
  14.     return path(data, data + sz);
  15. }
  16.  
  17.  
  18. int main() {   
  19.  
  20.     static regex inc_path(R"/(\s*#\s*include\s*<([^>]*)>\s*)/");
  21.     smatch m;          
  22.    
  23.     string line = "#include <std1.h>"s;
  24.     if (regex_match(line, m, inc_path)) {            
  25.         path f_name = string(m[1]);
  26.     }
  27. }
Tags: MF regex
Advertisement
Add Comment
Please, Sign In to add comment