diff --git a/src/main.cpp b/src/main.cpp index 7586d34..dbc773b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -83,7 +83,22 @@ int main(int argc, char *argv[]) vm["regexp"].as>()) { search::options opts; - // TODO: regex type. + if (vm.count("basic-regexp") > 0) + { + opts.regex = search::regex_type::basic; + } + if (vm.count("extended-regexp") > 0) + { + opts.regex = search::regex_type::extended; + } + if (vm.count("perl-regexp") > 0) + { + opts.regex = search::regex_type::perl; + } + if (vm.count("grep") > 0) + { + opts.grep_like = true; + } if (vm.count("ignore-case") > 0) { opts.ignore_case = true; diff --git a/src/search.hpp b/src/search.hpp index daf77e8..8a08600 100644 --- a/src/search.hpp +++ b/src/search.hpp @@ -39,9 +39,17 @@ struct match std::string page; //!< The page number, if available. }; +enum class regex_type +{ + basic, + extended, + perl +}; + struct options { - // TODO: regex type + regex_type regex{regex_type::basic}; + bool grep_like{false}; bool ignore_case{false}; bool nostrip{false}; std::uint64_t context{0};