I have this code
(defun string-match-test () (interactive) (string-match "12345" (buffer-string)) (setq STRING (match-string 0)) (read-string STRING) (goto-char (point-max)) (insert STRING) ) (string-match-test)
I expected it to print
12345 but I get, instead
"1234. What's my mistake? May I have misunderstood the
buffer-string function behaviour?
Note. I kwow I can use
serch-forward-regexp combined with
with-temp-buffer... but I'd like to understand the reason of this weird behaviur.