[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: regexp to strip off LaTeX command
From: |
henry atting |
Subject: |
Re: regexp to strip off LaTeX command |
Date: |
Sat, 20 Dec 2008 15:11:57 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
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