diff --git a/src/cxxopts.hpp b/src/cxxopts.hpp index 7e3936a..8adef0f 100644 --- a/src/cxxopts.hpp +++ b/src/cxxopts.hpp @@ -1 +1,10 @@ #include + +namespace cxxopts +{ + std::basic_regex option_matcher + ("--([a-zA-Z][-_a-zA-Z]+)(=(.*))?|-([a-zA-Z]+)"); + + std::basic_regex option_specifier + ("(([a-zA-Z]),)?([a-zA-Z][-_a-zA-Z]+)"); +} diff --git a/src/main.cpp b/src/main.cpp index 6f6a6f9..1faeee0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,13 +7,12 @@ int main(int argc, char* argv[]) try { - std::basic_regex options("--([a-zA-Z][-a-zA-Z]+)|-([a-zA-Z]+)"); std::match_results result; for (int i = 1; i < argc; ++i) { std::cout << "Argument " << i << std::endl; - std::regex_match(argv[i], result, options); + std::regex_match(argv[i], result, cxxopts::option_matcher); std::cout << "empty = " << result.empty() << std::endl; std::cout << "size = " << result.size() << std::endl;