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

feat(x/meg): Support capturing components #269

Merged
merged 6 commits into from
Feb 26, 2025

Conversation

MarcoPolo
Copy link
Contributor

Extends megular expressions to support capturing bytes as well. I have a branch that used generics, but Go is not yet good at inferring the type parameter and it looked a bit ugly. There was also not a significant performance increase in using generics for this here.

@MarcoPolo MarcoPolo requested a review from sukunrt February 20, 2025 01:47
Copy link
Member

@sukunrt sukunrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just capture the entire component?

Can be used by more specific capturers (e.g capture net.AddrIP)
@MarcoPolo
Copy link
Contributor Author

You're right. That would be useful for higher level capturers like "CaptureAddrPort". I'll push changes soon.

@MarcoPolo
Copy link
Contributor Author

I've exported CaptureWithF. That should provide what we need to build the higher level things on top of.

@MarcoPolo
Copy link
Contributor Author

I added CaptureAddrPort as an example capturer that composes other capturers into higher level types.

@MarcoPolo MarcoPolo changed the title feat(x/meg): Support capturing bytes feat(x/meg): Support capturing components Feb 20, 2025
@MarcoPolo MarcoPolo requested a review from sukunrt February 20, 2025 19:42
@MarcoPolo MarcoPolo mentioned this pull request Feb 26, 2025
@MarcoPolo MarcoPolo merged commit c14016b into marco/match-and-capture Feb 26, 2025
7 checks passed
MarcoPolo added a commit that referenced this pull request Feb 26, 2025
* Use Matchable interface

* Add Bytes to Matchable interface

* feat(x/meg): Support capturing bytes

* Export CaptureWithF

Can be used by more specific capturers (e.g capture net.AddrIP)

* Support Any match, RawValue, and multiple Concatenations

* Add CaptureAddrPort
@p-shahi p-shahi mentioned this pull request Feb 26, 2025
9 tasks
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

Successfully merging this pull request may close these issues.

2 participants