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

/e: Add match length to results #4908

Closed
wants to merge 1 commit into from

Conversation

kazarmy
Copy link
Member

@kazarmy kazarmy commented Feb 16, 2025

Your checklist for this pull request

  • I've read the guidelines for contributing to this repository.
  • I made sure to follow the project's coding style.
  • I've documented every RZ_API function and struct this PR changes.
  • I've added tests that prove my changes are effective (required for changes to RZ_API).
  • I've updated the Rizin book with the relevant information (if needed).

Detailed description

This pr adds the match length to /e regex search results since it can be different for different hits.

This pr is currently just a reminder that regex search results are incomplete without the match length. Once #4762 lands (which has the match length displayed for apparently all searches), this pr can be closed.

Test plan

All builds are green.

Closing issues

...

@kazarmy kazarmy force-pushed the slash-e-add-match-len branch from 0901873 to 51a9e84 Compare February 16, 2025 07:57
Copy link
Contributor

@notxvilka notxvilka left a comment

Choose a reason for hiding this comment

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

I like this change. But please wait for @Rot127 review

@Rot127
Copy link
Member

Rot127 commented Feb 19, 2025

It is addressed in the search PR as well. At least it saves the number of bytes of the hit (not number of characters). Is this a proper replacement? Let me just investigate some timeout issue and then I can open the new one for review.

@kazarmy
Copy link
Member Author

kazarmy commented Feb 19, 2025

At least it saves the number of bytes of the hit (not number of characters).

Regarding this pr, the match length shown is set here:

RzRegexMatch *m = *it;
kw->keyword_length = m->len; // For a regex search, the keyword can be of variable length

and m->len is from PCRE2 and is in bytes (according to this header comment):

RzRegexSize len; ///< Length of match in bytes.


Is this a proper replacement?

Not sure what you mean by this, but I'm not planning on working on counting code points, grapheme clusters etc. in the near future.


Let me just investigate some timeout issue and then I can open the new one for review.

If the search PR lands soon, then this pr is no longer necessary. If it doesn't, then I would like to merge this pr by the end of this week.

@Rot127
Copy link
Member

Rot127 commented Feb 19, 2025

Not sure what you mean by this, but I'm not planning on working on counting code points, grapheme clusters etc. in the near future.

Counting code points can be easily extended after the search PR is done. Because each detected string counts them already. They are just not applied to the RzSearchHit. Currently it stores only bytes as you did here as well.

If the search PR lands soon, then this pr is no longer necessary. If it doesn't, then I would like to merge this pr by the end of this week.

Ok for me.

@kazarmy
Copy link
Member Author

kazarmy commented Feb 21, 2025

Closing due to #4919

@kazarmy kazarmy closed this Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants