GNU bug report logs - #33175
26.1; match-string

Previous Next

Package: emacs;

Reported by: 濱田和明 <hmd24kaz <at> gmail.com>

Date: Sat, 27 Oct 2018 11:00:01 UTC

Severity: normal

Tags: notabug

Found in version 26.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> gmail.com>
To: 濱田和明 <hmd24kaz <at> gmail.com>
Cc: 33175 <at> debbugs.gnu.org
Subject: bug#33175: 26.1; match-string
Date: Sat, 27 Oct 2018 07:10:16 -0400
tags 33175 notabug
close 33175
quit

濱田和明 <hmd24kaz <at> 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))





This bug report was last modified 6 years and 269 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.