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 wrote: > >> From: Erik Anderson > >> 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. >