Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2016-11-25
07:31
Allow [array names -regexp] to use backreferences. This capability was broken by [71270e9141]. See a... check-in: b29701996a user: andy tags: trunk
2005-11-29
17:33 • Closed ticket [1366683fff]: lsearch -regexp does not support regexp's w/back... artifact: 2e8c643ca9 user: dkf
2005-11-26
01:04 • New ticket [1366683fff]. artifact: 4157eba7f4 user: cleverly

lsearch -regexp does not support regexp's w/backreferences

Closed / Fixed1366683fffffffffffffffffffffffffffffffffCreated 21 years agoUpdated 21 years ago
Descriptionplain2005-11-26 01:04:29
% info patchlevel
8.4.11
% regexp {^.(.)\1.$} 1220
1
% lsearch -regexp {1200 1210 1220 1230 1240 1250}
{^.(.)\1.$}
couldn't compile regular expression pattern: invalid
backreference number

On the chat Jeff Hobbs pointed out that it is because
[lsearch -regexp] compiles the regular expression with
the TCL_REG_NOSUB flag set (which inhibits capturing
parenthesis which backreferences require).  Simply fix
 is to remove the TCL_REG_NOSUB flag?

I think that [lsearch -regexp] should support regexp's
with backreferences, or, at the least, the man page
updated with the caveat that it doesn't support
backreferences (and a better error message).
dkfplain2005-11-29 17:33:48
Logged In: YES 
user_id=79902

Fixed in HEAD and 8.4 branch.
Log in (anonymous is fine) to add a comment.