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

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

bug#33175: 26.1; match-string


From: Noam Postavsky
Subject: bug#33175: 26.1; match-string
Date: Sat, 27 Oct 2018 07:10:16 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

tags 33175 notabug
close 33175
quit

濱田和明 <hmd24kaz@gmail.com> writes:

> (progn
>    (string-match "\\(key[ \t]*\\)= \\(.*\\)" (buffer-string))
>    (match-string 0))
>
> Key = 100
> ->#("
> Key = 10" 0 1 (fontified t) 1 9 (fontified t))
>
> Is not “key = 100”?

    (match-string NUM &optional STRING)

    [...]
    STRING should be given if the last search was by ‘string-match’ on STRING.

Try this instead:

    (let ((str (buffer-string)))
       (string-match "\\(key[ \t]*\\)= \\(.*\\)" str)
       (match-string 0 str))






reply via email to

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