Appendix A. Regular Expressions

IN THIS APPENDIX

Characters

Delimiters

Simple Strings

Special Characters

Rules

Bracketing Expressions

The Replacement String

Extended Regular Expressions

A regular expression defines a set of one or more strings of characters. Several of the GNU/Linux utilities, including vi, emacs, grep, gawk, and sed, use regular expressions to search for and replace strings. A simple string of characters is a regular expression that defines one string of characters: itself. A more complex regular expression uses letters, numbers, and special characters to define many different strings of characters. A regular expression is said to match any string it defines.

This appendix describes the regular expressions used by ed, vi, emacs,

Get A Practical Guide to Red Hat® Linux® 8 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.