待辦事項 #39449

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

啟用日期: 2019-08-02 22:48 最後更新: 2020-12-02 00:25

回報者:
負責人:
類型:
狀態:
關閉
元件:
里程碑:
(無)
優先權:
5 - 中
嚴重程度:
5 - 中
處理結果:
Duplicate
檔案:
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

細節

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
  • 處理結果 Update from to Duplicate
評語

Will address this issue in #39094.

2020-12-02 00:25 Updated by: magicant
  • 狀態 Update from 開啟 to 關閉
評語

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

Attachment File List

No attachments

編輯

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