Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-07-13
09:20 • Closed ticket [1513763fff]: The result of regexp is abnormal plus 6 other ch... artifact: 9a99d2059f user: sf-robot
2006-06-28
15:45 • Pending ticket [1513763fff]. artifact: b392a22a3e user: dkf
12:20 • Ticket [1513763fff]: 4 changes artifact: db7e2fe903 user: nobody
12:20 • Add attachment prime.tcl to ticket [1513763fff] artifact: 0b50f58abf user: nobody
05:20 • New ticket [1513763fff] The result of regexp is abnormal. artifact: 204a8587b3 user: nobody

The result of regexp is abnormal

Closed / Works For Me1513763fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-06-28 05:20:42
When I use regexp {^(oo+?)(\1)*$} to verify a number 
is prime or not. The result was abnormal.

I use another script like perl, python ...
It does work.
nobodyplain2006-06-28 12:20:42
File Added - 183214: prime.tcl
dkfplain2006-06-28 15:45:47
Logged In: YES 
user_id=79902

I've no idea what the above regular expression is trying to
achieve, since it will match any non-empty sequence of 'o'
characters (the * allows bits to be ignored). However, if I use:
   ^(oo+?)\1+$
as the RE (dropping one set of parens for simplicity and
changing to using a +) then I get a perfectly adequate
non-prime detector.
   % info patch
   8.4.7
   % #Print the lowest prime factor of 169...
   % string length [lindex [regexp -inline {^(oo+?)\1+$}
[string repeat o 169]] 1]
   13

Looks like pilot error to me.
sf-robotplain2006-07-13 09:20:18
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.

Attachments: