GNU sed Regular Expression Extensions
With the -r option, GNU sed uses Extended Regular Expressions
instead of Basic Regular Expressions. (See Chapter 7 for more information.)
However, even without -r, you can use additional
escape sequences for more powerful text matching. The following
escape sequences are valid only in regular expressions :
|
|
Matches on a word boundary, where
of the two surrounding characters
( |
|
|
Matches on a nonword boundary,
where both of the two surrounding characters
( |
|
|
Matches any word-constituent character (i.e., a letter, digit, or underscore). |
|
|
Matches any non-word-constituent character (i.e., anything that is not a letter, digit, or underscore). |
|
|
Matches the beginning of the
pattern space. This is different from |
|
|
Matches the end of the pattern
space. This is different from |
The following escape sequences may be used anywhere.
|
|
The ASCII BEL character. | ||
|
|
The ASCII formfeed character. | ||
|
|
The ASCII newline character. | ||
|
|
The ASCII carriage return character. | ||
|
|
The ASCII vertical tab character. |
|
The character whose ASCII decimal value is NN (version 4.0 and later). |
|
|
The character whose ASCII octal value is NN (version 4.0 and later). ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access