Tcl Source Code

View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.
Ticket UUID: 884d0ac78cbab248d054ec96d13c2a741bb0a94c
Title: Unexpected string-start constraint match in middle of string after newline
Type: Bug Version: core-8-6-branch tip, 28-Dec-2017
Submitter: dkf Created on: 2017-12-28 00:52:02
Subsystem: 43. Regexp Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2017-12-28 12:47:54
Resolution: None Closed By: nobody
    Closed on:

If you do:

   regexp -all {^|\n} "foo\nbar"
then it returns 3. I'd expect that (perhaps) with the -line option, but in standard mode that is rather "surprising" as there is only one place where the string starts and only one newline character.

User Comments: dkf added on 2017-12-28 12:47:54:

A consequence of this issue is this:

% puts [regsub -all "^|\n" "foo\nbar" "\nXX"]

The double substitution of \nXX before bar is again "unexpected".