Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: c1c403cdb8ed5de25606f7484a3362e22cae438d
Ticket: 1115587fffffffffffffffffffffffffffffffff
Regexp backreference fail with a * closure
User & Date: tgl on 2015-09-19 16:01:47
Changes

  1. assignee changed to: "aku"
  2. closer changed to: "nobody"
  3. comment changed to:
    The documentation has an example:
    
    "([bc])\1 matches bb or cc but not `bc'". So I tried:
    
    % regexp {^([bc])\1$} bb
    1
    % regexp {^([bc])\1$} cc
    1
    % regexp {^([bc])\1$} bc
    0
    
    All well and good. But what if we want b* or c* but not
    [bc]* (ie disallow bbcb). The obvious solution is \1*:
    
    % regexp {^([bc])\1*$} bbb
    1
    % regexp {^([bc])\1*$} bcb
    1
    
    bcb should not match!
    
    Oddly, using \1+ works (but means of course that "b" or
    "c" solo does not match).
    
    James
    
  4. icomment:
    See ticket http://core.tcl.tk/tcl/tktview?name=0e0e150e49479e3f for a proposed solution.
    
  5. login: "tgl"
  6. mimetype: "text/plain"
  7. severity changed to: "Minor"