Ticket UUID: | 1513763 | |||
Title: | The result of regexp is abnormal | |||
Type: | Bug | Version: | obsolete: 8.4.13 | |
Submitter: | nobody | Created on: | 2006-06-28 05:20:42 | |
Subsystem: | 43. Regexp | Assigned To: | pvgoran | |
Priority: | 5 Medium | Severity: | ||
Status: | Closed | Last Modified: | 2006-07-13 09:20:18 | |
Resolution: | Works For Me | Closed By: | sf-robot | |
Closed on: | 2006-07-13 02:20:18 | |||
Description: |
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. | |||
User Comments: |
sf-robot added on 2006-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). dkf added on 2006-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. nobody added on 2006-06-28 12:20:42: File Added - 183214: prime.tcl |
Attachments:
- prime.tcl [download] added by nobody on 2006-06-28 12:20:42. [details]