Advertisement
Guest User

RE2TestW32

a guest
May 26th, 2010
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. #include <re2/re2.h>
  2. #include <cstdio>
  3.  
  4. void CHECK(bool n) {
  5.     printf("%s\n",n?"true":"false");
  6. }
  7.  
  8. int main() {
  9.     CHECK(RE2::PartialMatch("123","^[0-9]+"));
  10.     CHECK(RE2::PartialMatch("abc123","^[0-9]+"));
  11.     CHECK(RE2::PartialMatch("123abx","^[0-9]+"));
  12.     CHECK(RE2::PartialMatch("12x3","^[0-9]+"));
  13.     CHECK(RE2::PartialMatch("12x3","^[0-9]{3,4}"));
  14.     CHECK(RE2::PartialMatch("125x3","^[0-9]{3,4}"));
  15.     return 0;
  16. }
  17.  
  18.  
  19. OUTPUT:
  20. true
  21. false
  22. true
  23. true
  24. false
  25. true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement