Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #compile g++ -Wall -I/usr/local/include Re2test.cpp -lre2 -lpthread
- #include <re2/re2.h>
- #include <iostream>
- using namespace re2;
- int main(void) {
- int i = 0;
- std::string s = "";
- if(RE2::FullMatch("hello", "h.*o")) std::cout << "PASS" << std::endl;
- if(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s, &i)) std::cout << "PASS" << std::endl;
- if(!RE2::FullMatch("ruby", "(.*)", &i)) std::cout << "PASS" << std::endl;
- if(!RE2::FullMatch("ruby:1234", "\\w+:\\d+", &s)) std::cout << "PASS" << std::endl;
- if(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s)) std::cout << "PASS" << std::endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment