help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: regular expression


From: Nuno J. Silva
Subject: Re: regular expression
Date: Mon, 25 Jan 2010 12:35:02 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Burkhard Schultheis <burkhard.schultheis@web.de> writes:

> I want to search for the following string: A hyphen not surrounded by
> spaces. Therefore I tried the following pattern:
> [^ ]-[^ ].
> But this pattern finds a hyphen preceded by a letter and followed by a
> newline character, too.
>
> How to exclude the newline character? I tried
> [^ ]-[^ \n]
> but that does not work. Why? And how to search for this?

I made up some test text in a buffer, and tried search-forward-regexp
with 

[^ ]-[^ \n]

and

[^ ]-[^ 
]

The second one works here. It has the result of hitting C-q C-j, instead
of \n, because there are other places where emacs won't match a newline
with \n, and needs this.

-- 
Nuno J. Silva
gopher://sdf-eu.org/1/users/njsg


reply via email to

[Prev in Thread] Current Thread [Next in Thread]