manpagez: man pages & more
info sed
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Appendix A Extended regular expressions

The only difference between basic and extended regular expressions is in the behavior of a few characters: ‘?’, ‘+’, parentheses, braces (‘{}’), and ‘|’. While basic regular expressions require these to be escaped if you want them to behave as special characters, when using extended regular expressions you must escape them if you want them to match a literal character. ‘|’ is special here because ‘\|’ is a GNU extension – standard basic regular expressions do not provide its functionality.

Examples:

abc?

becomes ‘abc\?’ when using extended regular expressions. It matches the literal string ‘abc?’.

c\+

becomes ‘c+’ when using extended regular expressions. It matches one or more ‘c’s.

a\{3,\}

becomes ‘a{3,}’ when using extended regular expressions. It matches three or more ‘a’s.

\(abc\)\{2,3\}

becomes ‘(abc){2,3}’ when using extended regular expressions. It matches either ‘abcabc’ or ‘abcabcabc’.

\(abc*\)\1

becomes ‘(abc*)\1’ when using extended regular expressions. Backreferences must still be escaped when using extended regular expressions.


This document was generated on January 5, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.