[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: replace-regexp not working?
From: |
lawrence mitchell |
Subject: |
Re: replace-regexp not working? |
Date: |
Tue, 22 Jul 2003 01:15:14 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 |
Sanford Selznick wrote:
> I have a file open (input.txt) and I'm trying to replace all "x" or "y"
> characters with a string, say "12".
> So I M-x replace-regexp RET (x|y) RET 12 RET
> And nothing happens. The cursor is at the beginning of the buffer.
> What am I doing wrong?
Emacs' regex's require you to quote some special characters. So,
characters like (, |, and ) are assumed non-special, unless you
quote them.
In your case, you would do:
M-x replace-regexp RET \(x\|y\) RET 12 RET
See the Emacs info node (info "(emacs)Regexps") for details.
--
lawrence mitchell <wence@gmx.li>