or() with capture()
还没有人认领这个 Issue。
评估
调研方向
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
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
VerbalExpressions/JavaVerbalExpressions 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
VerbalExpressions/JavaVerbalExpressions#76 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 35/100
VerbalExpressions/JavaVerbalExpressions#73 · 1 条评论 ·
-
难度 5/5 一周以上 新手友好度 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
-
BC remittance upload: a claim MSP refused (S03) is saved with a blank status instead of refused (F)未关闭type: bug
难度 2/5 1-3 小时 新手友好度 88/100
carlos-emr/carlos#4933 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
apache/rocketmq-dashboard#6925 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
Vakore/ZappierGames#147 ·
-
spigotmc
难度 1/5 1 小时以内 新手友好度 92/100
Dans-Plugins/Wild-Pets#356 ·
维护者通常 1 天内回复
-
spigotmc
难度 1/5 1 小时以内 新手友好度 85/100
Dans-Plugins/Medieval-Roleplay-Engine#371 ·
维护者通常 1 天内回复