From: "Lennart Borgman" <lennart.borgman@gmail.com>
To: "henry atting" <nspm_01@literaturlatenight.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: rexexp help needed
Date: Fri, 26 Dec 2008 18:11:54 +0100 [thread overview]
Message-ID: <e01d8a50812260911v12daf68dxb4a05ee711c1077c@mail.gmail.com> (raw)
In-Reply-To: <87myeix64y.fsf@literaturlatenight.de>
On Fri, Dec 26, 2008 at 5:17 PM, henry atting
<nspm_01@literaturlatenight.de> wrote:
> Zitat - Lennart Borgman * Fr Dez 26 2008 um 15:51 -
>
>> On Fri, Dec 26, 2008 at 3:20 PM, henry atting
>> <nspm_01@literaturlatenight.de> wrote:
>>> Hi,
>>>
>>> I am trying to build a rexexp that does the following:
>>> I have a text file where I want to replace
>>>
>>> Medicine:One:Two €12.00
>>>
>>> With
>>>
>>> Medicine €12.00
>>>
>>> Because I have more than one entry `Medicine' (and they
>>> differ slightly, something like `Medicine:Three:Four' and
>>> so on) I have to do it with `quere-replace-regexp'.
>>> With regexp-builder I found this:
>>>
>>> Medicine:.*[^€.0-9]
>>>
>>> This works both in regexp-builder and a scratch buffer, but
>>> unfortunately not in a file. If applied on a file replace-regexp
>>> strips everything from the first `:'.
>>
>> You have to escape the [] with \. That is a bit tricky since you have
>> to double the escape character. (One for text escaping, one for regexp
>> char escaping.)
>
>
> Mmh, IIRC I tried it already with escape sequences. Anyway, if I do so I
> get:
>
> Replaced 0 occurences
>
> No difference if I try it in a scratch buffer or a file.
> Without escaping it works in a scratch buffer at least. ;)
Eh, sorry. Everything (nearly) I wrote before was wrong. You do not
need to escape []. Something like this is what you want
(re-search-forward "Medicine:[^€]*")
next prev parent reply other threads:[~2008-12-26 17:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-26 14:20 rexexp help needed henry atting
2008-12-26 14:51 ` Lennart Borgman
[not found] ` <mailman.3376.1230303090.26697.help-gnu-emacs@gnu.org>
2008-12-26 16:17 ` henry atting
2008-12-26 17:11 ` Lennart Borgman [this message]
2008-12-26 23:04 ` Thierry Volpiatto
[not found] ` <mailman.3380.1230311518.26697.help-gnu-emacs@gnu.org>
2008-12-26 17:46 ` henry atting
[not found] ` <mailman.3378.1230308108.26697.help-gnu-emacs@gnu.org>
2008-12-26 16:54 ` harven
2008-12-26 16:53 ` Cecilio Pardo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e01d8a50812260911v12daf68dxb4a05ee711c1077c@mail.gmail.com \
--to=lennart.borgman@gmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=nspm_01@literaturlatenight.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).