[6888] in Athena Bugs
decmips 7.1H: emacs regexp matching of '$'
daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Mon Jan 14 01:41:38 1991
To: bugs@ATHENA.MIT.EDU
Date: Mon, 14 Jan 91 01:41:22 EST
From: Barr3y.Jaspan@ATHENA.MIT.EDU, bjaspan@mit.edu <bjaspan@ATHENA.MIT.EDU>
System name: hodge
Type and version: KN01 7.1H (2 update(s) to same version)
Display type: PM-MONO
What were you trying to do?
Search for the string '$1' in a text file in emacs; I have C-s bound
to isearch-forward-regexp, instead of isearch-forward.
What's wrong:
It worked. I searched for '$1' and emacs put the cursor on the first
occurrence of that string. Note that I did NOT search for '\$1' which
is what I would have expected to work. From the Emacs manual (the
section on regexps):
`$'
is similar to `^' but matches only at the end of a line. Thus,
`xx*$' matches a string of one `x' or more at the end of a line.
I tried this with re-search-forward and the same thing happened.
What should have happened:
I'm not sure if this is a bug in the emacs regexp code or a bug in the
Emacs manual. I like the (Perl-esque :-) behavior of $ matching
literally when there is text after it in a regexp; however, this
behavior is not mentioned in the manual. For reference:
(emacs-version)
"GNU Emacs 18.54.22 of Thu Aug 23 1990 on kangaroo (berkeley-unix)"
Please describe any relevant documentation references:
The GNU Emacs manual or Info tree (menu 'Regexps')