Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in README #304

Open
bortsov opened this issue Mar 22, 2024 · 0 comments
Open

Fix typo in README #304

bortsov opened this issue Mar 22, 2024 · 0 comments

Comments

@bortsov
Copy link

bortsov commented Mar 22, 2024

Chapter "Using captures"

It should be

auto result = ctre::match<"(?<year>\\d{4})/(?<month>\\d{1,2})/(?<day>\\d{1,2})">(s);
return date{result.get<"year">(), result.get<"month">, result.get<"day">};

// or in C++ emulation, but the object must have a linkage
static constexpr ctll::fixed_string year = "year";
static constexpr ctll::fixed_string month = "month";
static constexpr ctll::fixed_string day = "day";
return date{result.get<year>(), result.get<month>(), result.get<day>()};

// or use numbered access
// capture 0 is the whole match
return date{result.get<1>(), result.get<2>(), result.get<3>()};

Otherwise code can't be compiled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant