Subject: Re: bug#20950: 25.0.50; string-match in IELM operates on a wrong string

From: Eli Zaretskii <[email-masked]>
Date: Wed, 01 Jul 2015 18:51:00 +0300

> From: Oleg Sivokon <[email-masked]>
> Date: Wed, 01 Jul 2015 18:08:10 +0300
> 
> The problem is as follows. When `string-match` is called in IELM, while
> it searches in the correct string, `match-string` will operate on the
> contents of IELM buffer instead of the string being searched.  Below is
> a concrete example.  Consider this function:
> 
> (defun sphinx-parse-node (raw)
>   (let ((pos 0) result)
>     (while (string-match "'\\([^']+\\)'" raw pos)
>       (push (match-string 1) result)
>       (setq pos (match-end 0)))
>     (nreverse result)))

You need to pass the original string to match-string, when you match a
string and not buffer text.