Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2003-10-15
01:24 • Closed ticket [823524ffff]: bug in regsub in tcl8.4 version plus 7 other cha... artifact: 1e6d7f111d user: vincentdarley
00:13 • Ticket [823524ffff]: 6 changes artifact: b1f59be14f user: hobbs
2003-10-14
15:47 • New ticket [823524ffff]. artifact: 3ab0a4867a user: hemanglavana

bug in regsub in tcl8.4 version

Closed / Fixed823524ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2003-10-14 15:47:31
There seems to be a bug in regsub command in tcl8.4
version:

(bin) 1 % info patch
8.4.5
(bin) 2 % set b "a\nb\nc\nd"
a
b
c
d
(bin) 3 % regsub -all -line ^ $b #
#a
##b
##c
##d
(bin) 4 % regsub -all -line ^ $b # c
7
(bin) 5 % set c
#a
##b
##c
##d
(bin) 6 % package provide TclDevKit
3.0
(bin) 7 %

Note the ## for b, c and d lines. The tclversion is the
one provided by AK with TclDevKit3.0 pre-release.
Here's the output of correct behavior with tcl8.3:

squish:43> tclsh
% info patch
8.3.3
% set b "a\nb\nc\nd"
a
b
c
d
% regsub -all -line ^ $b #
wrong # args: should be "regsub ?switches? exp string
subSpec varName"
% regsub -all -line ^ $b # c
4
% set c
#a
#b
#c
#d
%
hobbsplain2003-10-15 00:13:03
Logged In: YES 
user_id=72656

This bug was introduced the following patch:

2003-06-17  Vince Darley

* 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.

Assigning to Vince to correct regression failure that would be 
shown with this test:

test regexp-21.11 {multiple matches handle newlines} {
    regsub -all -line -- ^ "a\nb\nc" \#
} "\#a\n\#b\n\#c"
vincentdarleyplain2003-10-15 01:24:40
Logged In: YES 
user_id=32170

Fixed.  Thanks for the report.
Log in (anonymous is fine) to add a comment.