Incidencia #39449

[[ foo =~ ERE ]] does not match EREs with parentheses

Abrir Fecha: 2019-08-02 22:48 Última actualización: 2020-12-02 00:25

Informador:
Propietario:
Tipo:
Estado:
Cerrado
Componente:
Hito:
(Ninguno)
Prioridad:
5 - Medium
Gravedad:
5 - Medium
Resolución:
Duplicate
Fichero:
Ninguno
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

Problem 1:

$ yash -c '[[ aaa =~ (foo|^a{2,}$) ]]'
yash -c:1: syntax error: `(' is not a valid operand in the conditional expression

The syntax error should not occur: parentheses are perfectly valid in EREs (extended regular expressions).

Problem 2:

$ ere='(foo|^a{2,}$)' yash -c '[[ aaa =~ $ere ]]'; echo $?
1

This should have matched, so should have returned 0.

The =~ operator in the test/[ builtin does not have either of these problems.

Ticket History (3/3 Histories)

2019-08-02 22:48 Updated by: mcdutchie
  • New Ticket "[[ foo =~ ERE ]] does not match EREs with parentheses" created
2019-08-04 20:43 Updated by: magicant
  • Resolución Update from Ninguno to Duplicate
Comentario

Will address this issue in #39094.

2020-12-02 00:25 Updated by: magicant
  • Estado Update from Open to Cerrado
Comentario

Problem 1 was fixed in r4151 and problem 2 in #39288. Thanks!

Attachment File List

No attachments

Editar

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Entrar