-
Notifications
You must be signed in to change notification settings - Fork 18
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
add minimal regex matcher #37
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #37 +/- ##
==========================================
+ Coverage 67.94% 69.30% +1.35%
==========================================
Files 9 10 +1
Lines 2611 2795 +184
==========================================
+ Hits 1774 1937 +163
- Misses 837 858 +21 ☔ View full report in Codecov by Sentry. |
struct aws_byte_cursor alternation = aws_byte_cursor_from_string(symbol->info.alternation); | ||
size_t chars_in_match = 0; | ||
while (aws_byte_cursor_next_split(&alternation, '|', &variant)) { | ||
if (aws_byte_cursor_starts_with(&text, &variant)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention in the rules that it just matches the first alternation and will fail for something like regex = (ab|abc)d and text = abcd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mentioning this in the rules in a .c file seems insufficient. If we're not going to handle certain patterns, we should detect and error out in regex_new()
But we can easily handle this. Simply scan over every variant, and use whichever one was longest.
struct aws_byte_cursor alternation = aws_byte_cursor_from_string(symbol->info.alternation); | ||
size_t chars_in_match = 0; | ||
while (aws_byte_cursor_next_split(&alternation, '|', &variant)) { | ||
if (aws_byte_cursor_starts_with(&text, &variant)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mentioning this in the rules in a .c file seems insufficient. If we're not going to handle certain patterns, we should detect and error out in regex_new()
But we can easily handle this. Simply scan over every variant, and use whichever one was longest.
Issue #, if available:
add support for regex matching in endpoint resolution
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.