Created
March 2, 2012 16:57
-
-
Save temoto/1959644 to your computer and use it in GitHub Desktop.
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 <pcrecpp.h> | |
#include <iostream> | |
int main(int argc, char *argv[]) { | |
// Don't sync C++ and C I/O | |
std::ios_base::sync_with_stdio(false); | |
if (argc < 2) { | |
std::cerr << "Usage: re_remove REGEX <input" << std::endl; | |
return 1; | |
} | |
const std::string re_src = argv[1]; | |
pcrecpp::RE re(re_src, pcrecpp::RE_Options() | |
.set_no_auto_capture(true) | |
.set_utf8(false)); | |
std::string line; | |
const std::string empty = ""; | |
while (std::getline(std::cin, line)) { | |
re.GlobalReplace(empty, &line); | |
std::cout << line << std::endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment