darvid / python-hyperscan

🐍 A CPython extension for the Hyperscan regular expression matching library.
https://python-hyperscan.readthedocs.io/en/latest/
MIT License
165 stars 28 forks source link

Named capture groups with Chimera #51

Open atomikalabs opened 1 year ago

atomikalabs commented 1 year ago

First, thanks for all the work on this extremely useful library –

https://github.com/darvid/python-hyperscan/issues/32#issuecomment-1195994588

Regarding named capture groups, does the above approach lead to a case in which, for a pattern like b'(?<foo>ax) bx (?<bar>cx), the names foo and bar can be recovered (along with their associated content) in the match handler?

The goal would be to obtain the necessary context to create a dictionary such as

{
    "foo": "ax",
    "bar": "cx",
}