Created
November 26, 2011 01:09
-
-
Save chezou/1394782 to your computer and use it in GitHub Desktop.
Sample code of re2 using FindAndConsume for repeatable match
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <re2/re2.h> | |
#include <vector> | |
using namespace std; | |
int main(){ | |
string str("あぶらかたぶら"); | |
re::RE2 re("(.ぶ)"); | |
re2::StringPiece input(str); | |
string r; | |
while(re2::RE2::FindAndConsume(&input, re, &r) ){ | |
cout << r << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works! Thank you very much.
However, searching for regular expression "por." requires to pass "(por.)" and not just "por.".