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

Named capture groups (?P<name>...) and (?'name'...) not implemented #325

Open
alexios-angel opened this issue Sep 21, 2024 · 2 comments
Open

Comments

@alexios-angel
Copy link

alexios-angel commented Sep 21, 2024

The named capture groups (?P<name>...) and (?'name'...) are unimplemented. If these are implemented in CTRE's grammar then it will be closer to PCRE.

#include <ctre.hpp>

int main(){
    ctre::match<"(?<name>a)">;

    // These do not work
    ctre::match<"(?'name'a)">;
    ctre::match<"(?P<name>a)">;
}

Compiler explorer link

(?'test1'test1)|(?<test2>test2)|(?P<test3>test3)

Regex101 link

@hanickadot
Copy link
Owner

I'm not sure if this is worth more complex grammar. Functionality is there, will update README.

@hanickadot
Copy link
Owner

In longterm I would actually prefer to migrate to ECMAscript, as PCRE is really terrible turing complete syntax.

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

2 participants