From: Mathias Dahl <brakjoller@gmail.com>
Subject: Strange behavior in search-forward-regexp?
Date: Sat, 11 Feb 2006 02:43:26 +0100 [thread overview]
Message-ID: <m2wtg21xhd.fsf@gmail.com> (raw)
Take these "buffers":
Buffer 0:
---------- this line is not part of the buffer ----------
row0;test0
row1;test1
row2;test2
---------------------------------------------------------
Buffer 1:
---------- this line is not part of the buffer ----------
row0;test0
row1;test1
row2;test2
---------------------------------------------------------
Evaluate these functions:
(defun test1 ()
(interactive)
(save-excursion
(goto-char (point-min))
(if (search-forward-regexp "^[^;]+;.*test1" nil t)
(message (match-string-no-properties 0)))))
(defun test2 ()
(interactive)
(save-excursion
(goto-char (point-min))
(if (search-forward-regexp "^.*test1" nil t)
(message (match-string-no-properties 0)))))
In buffer 0, test1 and test2 willreturn the same result, "row1;test1",
but in buffer 1, test1 will return "\nrow1;test1" (\n is a newline)
and test2 "row1;test1".
Can someone explain this to me? Why would, in the case of test1, the
newline be included just because the line before is empty?
next reply other threads:[~2006-02-11 1:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-11 1:43 Mathias Dahl [this message]
2006-02-11 2:04 ` Strange behavior in search-forward-regexp? Barry Margolin
2006-02-11 9:45 ` Mathias Dahl
2006-02-12 9:58 ` Barry Margolin
2006-02-12 14:58 ` Mathias Dahl
2006-02-12 21:19 ` Barry Margolin
2006-02-11 11:48 ` Peter Dyballa
2006-02-11 19:00 ` Mattis
2006-02-11 19:33 ` Peter Dyballa
[not found] ` <mailman.17.1139690074.2858.help-gnu-emacs@gnu.org>
2006-02-11 21:43 ` Mathias Dahl
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2wtg21xhd.fsf@gmail.com \
--to=brakjoller@gmail.com \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.