Skip to content

expr: '$' should act as a special character only at the end of regex or subexpression #7951

@frendsick

Description

@frendsick

The '$' character should be escaped when it is not used in a spot that makes it act as a special character.

It is the same as ^, but refers to end of pattern space. $ also acts as a special character only at the end of the regular expression or subexpression (that is, before \) or \|), and its use at the end of a subexpression is not portable.

Reference: https://www.gnu.org/software/sed/manual/html_node/BRE-syntax.html

The test test_bre11 is failing because the '$' is not escaped. On the other hand, test_bre13 works almost by accident, because the '$' character is never escaped in the first place. Both of these tests should pass after fixing the interpretation of the '$' character.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions