Skip to content

Instantly share code, notes, and snippets.

@osiewicz
Created November 12, 2019 22:59
Show Gist options
  • Save osiewicz/674a68458dcf662573769781710ee036 to your computer and use it in GitHub Desktop.
Save osiewicz/674a68458dcf662573769781710ee036 to your computer and use it in GitHub Desktop.
CTRE issue 78 minimal reproducible code
#include <string_view>
#include "ctre.hpp"
constexpr static auto first = ctll::fixed_string {"(\\d{4})-(\\d{2})-(\\d{2})"};
constexpr static auto second = ctll::fixed_string {"(\\d{4})-(\\d{2})-(\\d{2})( |T)(\\d{2}):(\\d{2}):(\\d{2})"};
constexpr static auto third = ctll::fixed_string {"(\\d{4})-(\\d{2})-(\\d{2})( |T)(\\d{2}):(\\d{2}):(\\d{2})(\\.\\d{1,9})?"};
constexpr auto match_any(std::string_view view){
return ctre::match<first>(view) || ctre::match<second>(view) || ctre::match<third>(view);
}
int main(int argc, char ** argv){
return match_any(std::string_view(argv[1]));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment