You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a stage.match block containing several stage.regex blocks, each of which has an expression containing one or more ?P<...> named capture groups. I want all of those as labels, and for that I need to repeat myself by explicitly defining a stage.labels block which lists all of those capture group names. Instead I propose to introduce namespacing for capture groups which themselves signal to be exported as a label.
Thanks for the feedback! That definitely sounds like a useful feature, I would personally lean towards adding an attribute to the regex stage that would add all capture groups as labels, but I'm open to other implementations. I can't offer a timeline right now on internal development of this feature, but you or any other community member are more than welcome to make a PR for the contribution as well!
Hey @dehaansa This does sound like a useful feature! I’m interested in taking a look at this over the weekend.
As mentioned, adding an attribute to the regex stage — maybe something like export_named_groups = true — could be a clean way to automatically promote all named capture groups as labels without needing to repeat them in stage.labels. That approach feels intuitive and backward-compatible.
I’m still fairly new to the Alloy codebase (just submitted my first PR recently), but I’d love to give this a shot if that sounds reasonable. Let me know if there's anything specific I should consider while exploring this!
Request
I have a
stage.match
block containing severalstage.regex
blocks, each of which has anexpression
containing one or more?P<...>
named capture groups. I want all of those as labels, and for that I need to repeat myself by explicitly defining astage.labels
block which lists all of those capture group names. Instead I propose to introduce namespacing for capture groups which themselves signal to be exported as a label.Use case
For example:
may become
I would also be happy with some other mechanism which removes the burden to repeat oneself in a non-trivial way.
The text was updated successfully, but these errors were encountered: