Tcl Source Code

View Ticket
Login
Ticket UUID: 3414132
Title: Regsub repeats "supSpec"
Type: Bug Version: obsolete: 8.5.10
Submitter: Created on: 2011-09-26 18:05:14
Subsystem: 43. Regexp Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2013-11-12 12:32:24
Resolution: Invalid Closed By: dkf
    Closed on: 2013-11-12 12:32:24
Description:
Same problem on 8.6b2

% regsub -all -- {(.*)} "something" {\1test}
somethingtesttest

The same:
% regsub -all -- {(.*)} "something" {\1 test}
something test test

With $:
% regsub -all -- {(.*)$} "something" {\1 test}
something test test

But with ^ (or ^ and $):
% regsub -all -- {^(.*)} "something" {\1 test}
something test
% regsub -all -- {^(.*)$} "something" {\1 test}
something test
User Comments: dgp added on 2011-09-28 00:08:46:
This change happened in checkins
31ae6969b0 and 6f6bf2acac on
2003-06-17 and was first released
in 8.4.3 and 8.5a1.  Commit message
calls it a bug fix:

2003-06-17  Vince Darley  <[email protected]>

        * generic/tclCmdMZ.c:
        * tests/regexp.test: fixing of bugs related to regexp and regsub
        matching of empty strings. Addition of a number of new tests.

dgp added on 2011-09-27 23:26:48:
(.*) matches the empty string.

added on 2011-09-27 01:09:51:
Without -all it's ok too.