Skip to content

expr: Handle \{ literally at the start of an expression or subexpression #8009

@frendsick

Description

@frendsick

Normally, \{ begins a range quantifier like {n,m}. However, at the start of the regex or its subexpression (after \( or \|), there is no preceding item to which the quantifier can be applied. The expr command should handle \{ literally at the start of the regex or its subexpression.

Examples

  • expr '{abc}' : '\{abc\}'
    • Expected: "5"
    • Got: "expr: Invalid content of {}"
  • expr 'a{bc}' : 'a\(\{bc\}\)'
    • Expected: "{bc}"
    • Got: "expr: Invalid content of {}"
  • expr '{b}' : 'a\|\{b\}'
    • Expected: "3"
    • Got: "expr: Invalid content of {}"
  • expr '{' : 'a\|\{'
    • Expected: "1"
    • Got: expr: Unmatched \{

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