Tíquete #39449

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

: 2019-08-02 22:48 Última Atualização: 2020-12-02 00:25

Relator:
Dono:
Tipo:
Estado:
Fechado
Componente:
Marcos:
(Nenhum)
Prioridade:
5 - Medium
Gravidade:
5 - Medium
Resolução:
Duplicate
Arquivo:
Nenhum
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
  • Resolução Update from Nenhum to Duplicate
Comentário

Will address this issue in #39094.

2020-12-02 00:25 Updated by: magicant
  • Estado Update from Aberto to Fechado
Comentário

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. » Login