Ticket #39449

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

Open Date: 2019-08-02 22:48 Last Update: 2019-08-04 20:43

Reporter:
Owner:
Type:
Status:
Open [Owner assigned]
Component:
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Duplicate
File:
None
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 (2/2 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
  • Resolution Update from None to Duplicate
Comment

Will address this issue in #39094.

Attachment File List

No attachments

Edit

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