Skip to content

Instantly share code, notes, and snippets.

@chezou
Created November 26, 2011 01:09
Show Gist options
  • Save chezou/1394782 to your computer and use it in GitHub Desktop.
Save chezou/1394782 to your computer and use it in GitHub Desktop.
Sample code of re2 using FindAndConsume for repeatable match
#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