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

Regex match logic: Rust is_match() vs. JDK matches() #31

Closed
35VLG84 opened this issue Dec 20, 2024 · 1 comment
Closed

Regex match logic: Rust is_match() vs. JDK matches() #31

35VLG84 opened this issue Dec 20, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@35VLG84
Copy link
Collaborator

35VLG84 commented Dec 20, 2024

JDK

boolean matches() Attempts to match the entire region against the pattern.

Rust

Returns true if and only if there is a match for the regex anywhere in the haystack given.

Rust examples:

In this crate, every regex search is run with an implicit (?s:.)*? at the beginning of its pattern, which allows the regex to match anywhere in a haystack. Anchors, as above, can be used to ensure that the full haystack matches a pattern.

This will make Account Selectors behave differently, and on the other hand, the fix (^pattern$) will change Account Selector Checksums.

35VLG84 added a commit to e257-fi/tackler-t3db that referenced this issue Dec 20, 2024
e257-fi/tackler-ng#31

Signed-off-by: 35V LG84 <35vlg84-x4e6b92@e257.fi>
35VLG84 added a commit to e257-fi/tackler-tests that referenced this issue Dec 20, 2024
test: 5c34d752-8d17-40df-be91-5dc1b107478e

e257-fi/tackler-ng#31

Signed-off-by: 35V LG84 <35vlg84-x4e6b92@e257.fi>
@35VLG84 35VLG84 added the bug Something isn't working label Dec 20, 2024
@35VLG84 35VLG84 changed the title Account Selector match logic: rust is_match() vs. JDK matches() Regex match logic: Rust is_match() vs. JDK matches() Dec 20, 2024
@35VLG84
Copy link
Collaborator Author

35VLG84 commented Dec 20, 2024

So the Rust regex must be anchored to have the same behavior as with JDK matches.

^(?:regex-from-network)$ should do the trick,
ref: rust-lang/regex#737 (reply in thread)

The Regex and RegexSets have to be peeled away from that wrapper before calculating the checksum.

35VLG84 added a commit to e257-fi/tackler-tests that referenced this issue Dec 21, 2024
t3db: 5c34d752-8d17-40df-be91-5dc1b107478e

e257-fi/tackler-ng#31

Signed-off-by: 35V LG84 <35vlg84-x4e6b92@e257.fi>
35VLG84 added a commit that referenced this issue Dec 22, 2024
GH-31

Signed-off-by: 35V LG84 <35vlg84-x4e6b92@e257.fi>
35VLG84 added a commit to e257-fi/tackler-tests that referenced this issue Dec 22, 2024
t3db: 5c34d752-8d17-40df-be91-5dc1b107478e,
      85d16b5a-cde9-40d3-9a37-3b7ba7ee7049

e257-fi/tackler-ng#31

Signed-off-by: 35V LG84 <35vlg84-x4e6b92@e257.fi>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant