sed: ERE syntax
1
1 5.4 Overview of extended regular expression syntax
1 ==================================================
1
1 The only difference between basic and extended regular expressions is in
1 the behavior of a few characters: '?', '+', parentheses, braces ('{}'),
1 and '|'. While basic regular expressions require these to be escaped if
1 you want them to behave as special characters, when using extended
1 regular expressions you must escape them if you want them _to match a
1 literal character_. '|' is special here because '\|' is a GNU extension
1 - standard basic regular expressions do not provide its functionality.
1
1 Examples:
1 'abc?'
1 becomes 'abc\?' when using extended regular expressions. It
1 matches the literal string 'abc?'.
1
1 'c\+'
1 becomes 'c+' when using extended regular expressions. It matches
1 one or more 'c's.
1
1 'a\{3,\}'
1 becomes 'a{3,}' when using extended regular expressions. It
1 matches three or more 'a's.
1
1 '\(abc\)\{2,3\}'
1 becomes '(abc){2,3}' when using extended regular expressions. It
1 matches either 'abcabc' or 'abcabcabc'.
1
1 '\(abc*\)\1'
1 becomes '(abc*)\1' when using extended regular expressions.
1 Backreferences must still be escaped when using extended regular
1 expressions.
1
1 'a\|b'
1 becomes 'a|b' when using extended regular expressions. It matches
1 'a' or 'b'.
1