or() with capture()
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 45/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Java
- Stelle
- 2.6k
- Fork
- 243
- Merge medio
- 26m
- PR unite (30g)
- 1
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di VerbalExpressions/JavaVerbalExpressions
-
No lookarounds support Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
VerbalExpressions/JavaVerbalExpressions#76 · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
VerbalExpressions/JavaVerbalExpressions#73 · 1 commento ·
-
How do you express [0-9.,] Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
VerbalExpressions/JavaVerbalExpressions#66 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
VerbalExpressions/JavaVerbalExpressions#63 · 1 commento ·
-
or for no string Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 30/100
Tutte le issue di VerbalExpressions/JavaVerbalExpressions
Issue simili
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
inu-appcenter/memorIN-backend#288 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
frontend maui-pilot pilot-ask question
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
executions.Query — startDate and timeRange filters are sent with inverted comparison operators Apertaarea/plugin
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
kestra-io/plugin-kestra#190 ·