Skip to content

Instantly share code, notes, and snippets.

@chezou
Created November 25, 2011 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chezou/1393431 to your computer and use it in GitHub Desktop.
Save chezou/1393431 to your computer and use it in GitHub Desktop.
Sample of re2 libirary in Japanese
#compile g++ -Wall re2test.cpp -o re2.out -lre2 -lpthread
#include <iostream>
#include <string>
#include <re2/re2.h>
#include <cassert>
using namespace std;
int main(int argc, char **argv){
string s,t;
string str("あぶらかたぶら");
RE2 re1("(.ら).(.ぶ)");
assert(re1.ok());
if(RE2::PartialMatch(str, re1 , &s, &t))
cout << "s:"<< s << " t:"<< t << endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment