Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

or() with capture()

Đang mở
#32 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
tooling

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

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của VerbalExpressions/JavaVerbalExpressions

Tất cả issue của VerbalExpressions/JavaVerbalExpressions

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.