From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: henry atting Newsgroups: gmane.emacs.help Subject: Re: regexp to strip off LaTeX command Date: Sat, 20 Dec 2008 15:11:57 +0100 Organization: 1&1 Internet AG Message-ID: <87ljubvsuq.fsf@literaturlatenight.de> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1229784060 24191 80.91.229.12 (20 Dec 2008 14:41:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Dec 2008 14:41:00 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 20 15:42:06 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LE31o-0003DK-1U for geh-help-gnu-emacs@m.gmane.org; Sat, 20 Dec 2008 15:42:04 +0100 Original-Received: from localhost ([127.0.0.1]:57322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LE30b-0006dA-41 for geh-help-gnu-emacs@m.gmane.org; Sat, 20 Dec 2008 09:40:49 -0500 Original-Path: news.stanford.edu!headwall.stanford.edu!news.glorb.com!news2!newsfeed00.sul.t-online.de!t-online.de!inka.de!peernews!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 55 Original-NNTP-Posting-Host: port-92-195-239-178.dynamic.qsc.de Original-X-Trace: online.de 1229782143 15140 92.195.239.178 (20 Dec 2008 14:09:03 GMT) Original-X-Complaints-To: abuse@einsundeins.com Original-NNTP-Posting-Date: Sat, 20 Dec 2008 14:09:03 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:DFsTiFKp8T5RN3TF/YLjea3ocXM= Original-Xref: news.stanford.edu gnu.emacs.help:165540 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:60871 Archived-At: Zitat - Bourgneuf Francois * Fr Dez 19 2008 um 10:47 - >> -----Message d'origine----- >> De : >> help-gnu-emacs-bounces+francois.bourgneuf=groupe-mma.fr@gnu.or >> g >> [mailto:help-gnu-emacs-bounces+francois.bourgneuf=groupe-mma.f >> r@gnu.org] De la part de henry atting >> Envoyé : jeudi 18 décembre 2008 10:48 >> À : help-gnu-emacs@gnu.org >> Objet : Re: regexp to strip off LaTeX command >> >> Zitat - Andreas Politz * Do Dez 18 2008 um 10:19 - >> >> > henry atting wrote: >> >> Hi, >> >> >> >> I am searching a regexp for `replace-regexp' to remove >> only one LaTeX >> >> command. Let's say I want to remove all \textit{} commands >> but not the >> >> text within the braces, how can I do this? >> >> >> >> henry >> >> >> > >> > \\textit{\([^}]*\)} -> \1 >> > >> > If you need to handle escaped brackets the regexp gets a >> little longer. >> > >> > -ap >> >> Thanks, works fine. :) >> >> I understand the first part but can you please explain what >> `\1' stands >> for? >> >> henry >> > > \1 stands for "what is found between the first parenthesis \( [^}]* \)" > Example : > \(foo\).*\(bar\) ->\1 \2 would return foo bar (if foo and bar were > found in the text, of course). > Bour9 Copy that ;) Great thanks to all! Detex is good for stripping off *all* commands of a region but for a single command I find `query-replace-regexp' more convenient. henry