Tcl Source Code

View Ticket
Login
Ticket UUID: 697b1bbfe3387b8f777e55d4aba9a4e20833e8ed
Title: Incorrect argument handling by [regexp]
Type: Bug Created on: 2022-09-18 11:30:05
Submitter: erikleunissen Assigned to: nobody
Subsystem: 18. Commands M-Z Severity: Minor
Priority: 5 Medium Last modified: 2022-09-18 11:30:05
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: trunk
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