Ticket #3460: regex.cpp
| File regex.cpp, 407 bytes (added by , 13 years ago) |
|---|
| Line | |
|---|---|
| 1 | #include <boost/regex.hpp> |
| 2 | #include <string> |
| 3 | #include <iostream> |
| 4 | |
| 5 | int main(void) |
| 6 | { |
| 7 | static const boost::regex regex("^blah\\.txt", boost::regex::perl | boost::regex::icase); |
| 8 | const std::string teststring = "blah.txt"; |
| 9 | const bool matched = boost::regex_match(teststring, regex); |
| 10 | if(matched) |
| 11 | std::cout << "regex matched" << std::endl; |
| 12 | else |
| 13 | std::cout << "regex did not match" << std::endl; |
| 14 | return 0; |
| 15 | } |
