# HG changeset patch # User Richard M. Stallman # Date 1166895003 0 # Node ID 5fffe049d3bf10989bc2ad17ba4d08088959abcf # Parent 2cd58794c74362450a1b263862e3131f7df9eac5 (Regexp Search): Explain why forward and reverse regexp search are not mirror images. diff -r 2cd58794c743 -r 5fffe049d3bf man/search.texi --- a/man/search.texi Sat Dec 23 10:29:59 2006 +0000 +++ b/man/search.texi Sat Dec 23 17:30:03 2006 +0000 @@ -488,6 +488,13 @@ you have searched for @samp{foo} and you add @samp{\|bar}, the cursor backs up in case the first @samp{bar} precedes the first @samp{foo}. + Forward and backward regexp search are not symmetrical, because +regexp matching in Emacs always operates forward, starting with the +beginning of the regexp. Thus, forward regexp search scans forward, +trying a forward match at each possible starting position. Backward +regexp search scans backward, trying a forward match at each possible +starting position. These search methods are not mirror images. + @findex re-search-forward @findex re-search-backward Nonincremental search for a regexp is done by the functions