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 \{