Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <re2/re2.h>
- #include <cstdio>
- void CHECK(bool n) {
- printf("%s\n",n?"true":"false");
- }
- int main() {
- CHECK(RE2::PartialMatch("123","^[0-9]+"));
- CHECK(RE2::PartialMatch("abc123","^[0-9]+"));
- CHECK(RE2::PartialMatch("123abx","^[0-9]+"));
- CHECK(RE2::PartialMatch("12x3","^[0-9]+"));
- CHECK(RE2::PartialMatch("12x3","^[0-9]{3,4}"));
- CHECK(RE2::PartialMatch("125x3","^[0-9]{3,4}"));
- return 0;
- }
- OUTPUT:
- true
- false
- true
- true
- false
- true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement