Tcl Source Code

View Ticket
Login
Ticket UUID: 697b1bbfe3387b8f777e55d4aba9a4e20833e8ed
Title: Incorrect argument handling by [regexp]
Type: Bug Version: trunk
Submitter: erikleunissen Created on: 2022-09-18 11:30:05
Subsystem: 18. Commands M-Z Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2022-09-18 11:30:05
Resolution: None Closed By: nobody
    Closed on:
Description:
Here are the results of six invocations of the "regexp" command.
They indicate incorrect argument handling.


% set str "a-z"
a-z
% regexp - $str; #1
bad option "-": must be -all, -about, -indices, -inline, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --
% regexp \- $str; #2
1
% regexp {-} $str; #3
bad option "-": must be -all, -about, -indices, -inline, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --
% regexp -\\ $str; #4
couldn't compile regular expression pattern: invalid escape \ sequence
% regexp \\- $str; #5
1
% set initstring "-"
-
% regexp $initstring $str; #6
1
%

This discussion thread at c.l.t. provides some clues:

    https://groups.google.com/g/comp.lang.tcl/c/pbqqj8tcIUk