Next: , Previous: , Up: Searching and Matching   [Contents][Index]

44.2 Regular Expressions

A regular expression (regexp, for short) is a pattern that denotes a (possibly infinite) set of strings. Searching for matches for a regexp is a very powerful operation. This section explains how to write regexps; the following section says how to search for them.

To gain a thorough understanding of regular expressions and how to use them to best advantage, we recommend that you study Mastering Regular Expressions, by Jeffrey E.F. Friedl, O’Reilly and Associates, 1997. (It’s known as the "Hip Owls" book, because of the picture on its cover.) You might also read the manuals to (gawk)Top, (ed)Top, sed, grep, (perl)Top, (regex)Top, (rx)Top, pcre, and (flex)Top, which also make good use of regular expressions.

The SXEmacs regular expression syntax most closely resembles that of ed, or grep, the GNU versions of which all utilize the GNU regex library. SXEmacs’ version of regex has recently been extended with some Perl–like capabilities, described in the next section.