From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Espen Newsgroups: gmane.emacs.help Subject: Query replace regex with 2 alternatives Date: Fri, 07 Dec 2012 11:51:44 -0500 Organization: A noiseless patient Spider Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1354899315 18907 80.91.229.3 (7 Dec 2012 16:55:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 7 Dec 2012 16:55:15 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Dec 07 17:55:28 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Th1Cu-0004ry-7Z for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Dec 2012 17:55:24 +0100 Original-Received: from localhost ([::1]:60429 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Th1Ci-0006Z4-2A for geh-help-gnu-emacs@m.gmane.org; Fri, 07 Dec 2012 11:55:12 -0500 Original-Path: usenet.stanford.edu!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 21 Injection-Info: mx04.eternal-september.org; posting-host="960b39603e44c0554faedf0065e3beaf"; logging-data="22503"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5GPK5u6k3JAt9VPo/n6cZKyOqJgE3dGc=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) Cancel-Lock: sha1:StkxVYJlzRqFFfoJ0b/f/QraY5w= sha1:qgEa9hrWqFeqmK7kmbDWPBDvBWU= Original-Xref: usenet.stanford.edu gnu.emacs.help:195751 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88073 Archived-At: Could use some help on query/replace/regex. I have an html file full of < and >. I want to replace only some of the pairs with "[" and "]". I figured out the match string: "\\(<\\|>\\) (typed as) "\(<\|>\) but when it comes to the replacement, I'm not clear on how to say, first match gets [ and second match gets ]. I believe emacs can do it but I don't see it documented. I see references to \1 \2 but not in the replace string. -- Dan Espen