Created
November 12, 2019 22:59
-
-
Save osiewicz/674a68458dcf662573769781710ee036 to your computer and use it in GitHub Desktop.
CTRE issue 78 minimal reproducible code
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 <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