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.