Guest User

Untitled

a guest
May 25th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #compile g++ -Wall -I/usr/local/include Re2test.cpp -lre2 -lpthread
  2.  
  3. #include <re2/re2.h>
  4. #include <iostream>
  5.  
  6. using namespace re2;
  7.  
  8. int main(void) {
  9.  
  10. int i = 0;
  11. std::string s = "";
  12.  
  13. if(RE2::FullMatch("hello", "h.*o")) std::cout << "PASS" << std::endl;
  14. if(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s, &i)) std::cout << "PASS" << std::endl;
  15. if(!RE2::FullMatch("ruby", "(.*)", &i)) std::cout << "PASS" << std::endl;
  16. if(!RE2::FullMatch("ruby:1234", "\\w+:\\d+", &s)) std::cout << "PASS" << std::endl;
  17. if(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s)) std::cout << "PASS" << std::endl;
  18.  
  19. return 0;
  20. }
Add Comment
Please, Sign In to add comment