or() with capture()
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 2.6k
- フォーク
- 243
- 平均マージ
- 26分
- マージ済み PR(30日)
- 1
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
VerbalExpressions/JavaVerbalExpressions のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
VerbalExpressions/JavaVerbalExpressions#76 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
VerbalExpressions/JavaVerbalExpressions#73 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
VerbalExpressions/JavaVerbalExpressions#66 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
VerbalExpressions/JavaVerbalExpressions#63 · コメント 1 件 ·
-
or for no string オープン
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
VerbalExpressions/JavaVerbalExpressions の issue をすべて見る
似ている issue
-
area/plugin
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
kestra-io/plugin-kestra#190 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
google-ai-edge/LiteRT-LM#3739 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
integra-team-red/meet-map#249 ·
-
[Studio][Bug] Cancelled create-user dialog keeps the password and admin switch for the next attempt オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
apache/rocketmq-dashboard#5064 ·