From: SourceForge.net <no...@so...> - 2006-06-28 14:48:52
|
Bugs item #1513763, was opened at 2006-06-27 22:20 Message generated for change (Comment added) made by dkf You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1513763&group_id=10894 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 42. Regexp Group: current: 8.4.13 Status: Pending Resolution: Works For Me Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Pavel Goran (pvgoran) Summary: The result of regexp is abnormal Initial Comment: 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. ---------------------------------------------------------------------- Comment By: Donal K. Fellows (dkf) Date: 2006-06-28 01:45 Message: 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. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110894&aid=1513763&group_id=10894 |