or() with capture()
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
Hướng nghiên cứu
Start by reading the implementation of or() and compare its grouping behavior with the oneOf() implementation proposed in pull request #31. Reproduce the expression from the issue against "def" and verify that the completed change produces the expected regex and captures the match.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
It seems to me that the following expression:
VerbalExpression testRegex = regex()
.capture()
.find("abc")
.or("def")
.build();
should evaluate to the regex: /(?:((?:abc)|(?:(?:def))))/, but instead it evaluates to: /(?:((?:abc))|(?:(?:def)))/. As a result, if we test this expression against the string "def" it produces a match but no group is captured. This happens because the implementation of or() closes any opening parenthesis it finds in the string that precedes it.
I don't know why or() was implemented this way, but I believe the implementation of oneOf() I propose in https://github.com/VerbalExpressions/JavaVerbalExpressions/pull/31 may fix this problem.
- Ngôn ngữ chính
- Java
- Star
- 2.6k
- Fork
- 243
- Merge trung bình
- 26 phút
- Pull request đã merge (30 ngày)
- 1
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của VerbalExpressions/JavaVerbalExpressions
-
No lookarounds support Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
VerbalExpressions/JavaVerbalExpressions#76 · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
VerbalExpressions/JavaVerbalExpressions#73 · 1 bình luận ·
-
How do you express [0-9.,] Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
VerbalExpressions/JavaVerbalExpressions#66 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
VerbalExpressions/JavaVerbalExpressions#63 · 1 bình luận ·
-
or for no string Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
Tất cả issue của VerbalExpressions/JavaVerbalExpressions
Issue tương tự
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
inu-appcenter/memorIN-backend#288 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
frontend maui-pilot pilot-ask question
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Đang mởarea/plugin
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
kestra-io/plugin-kestra#190 ·