all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Erik Anderson <erikbpanderson@gmail.com>
To: Noam Postavsky <npostavs@users.sourceforge.net>,
	Eli Zaretskii <eliz@gnu.org>
Cc: 15107@debbugs.gnu.org
Subject: bug#15107: [PATCH] Add replace-regexp-in-string regression test
Date: Wed, 31 Aug 2016 15:32:58 +0000	[thread overview]
Message-ID: <CAAFf7azJ6N8tpR_+XTvKeCKECCPwYmCr8Tg0dpG7kcPPZUhBqQ@mail.gmail.com> (raw)
In-Reply-To: <CAM-tV-8_MycDEHz8F6+6jsaD6jQJ18_wSNdMy-05hTBkKdTNPg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1615 bytes --]

I suspect that since ".*" is such a commonly used term in regexps, Eli
might be misreading the regexp.

From the Emacs manual on regular expression special characters:
"‘.’ (Period)

is a special character that matches any single character except a newline.
Using concatenation, we can make regular expressions like ‘a.b’, which
matches any three-character string that begins with ‘a’ and ends with ‘b’."
You can verify the behavior of "."

(string-match "^." "No greedy modifiers here")
(match-data)
> (0 1)

(string-match "^.*" "This has a greedy modifier")
(match-data)
> (0 26)

This is a helpful document:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Regexp-Special.html#Regexp-Special

Further discussion should be moved off this list.

-Erik.

On Wed, Aug 31, 2016 at 10:13 AM Noam Postavsky <
npostavs@users.sourceforge.net> wrote:

> On Wed, Aug 31, 2016 at 11:01 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> >> From: Erik Anderson <erikbpanderson@gmail.com>
> >> Date: Wed, 31 Aug 2016 14:36:06 +0000
> >> Cc: 15107@debbugs.gnu.org
> >>
> >> Per the replace-regexp-in-string docstring: "Replace all matches for
> REGEXP with REP in STRING."
> >
> > Yes, and there is a single match in this case, so a single
> > replacement.  The _entire_ input string matches the regexp, so after
> > that match there's nothing else left to match.
> >
> > What am I missing?
>
> "^." matches only the first character of "foo bar", but maybe you have
> a different idea of "matches" than I do. I would consider "^..*" to
> match the whole string.
>

[-- Attachment #2: Type: text/html, Size: 2610 bytes --]

  reply	other threads:[~2016-08-31 15:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-15 22:15 bug#15107: 24.3; replace-regexp-in-string wrong on \` Kevin Ryde
2016-03-06  4:18 ` bug#15107: reproduced on emacs-25 branch Michael Wright
2016-08-30 23:57 ` bug#15107: [PATCH] Add replace-regexp-in-string regression test Erik Anderson
2016-08-31 14:24   ` Eli Zaretskii
2016-08-31 14:36     ` Erik Anderson
2016-08-31 15:01       ` Eli Zaretskii
2016-08-31 15:13         ` Noam Postavsky
2016-08-31 15:32           ` Erik Anderson [this message]
2016-08-31 16:04           ` Eli Zaretskii
2016-09-01 15:46   ` Eli Zaretskii

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=CAAFf7azJ6N8tpR_+XTvKeCKECCPwYmCr8Tg0dpG7kcPPZUhBqQ@mail.gmail.com \
    --to=erikbpanderson@gmail.com \
    --cc=15107@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=npostavs@users.sourceforge.net \
    /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.