This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author jorendorff
Recipients jorendorff, mark.dickinson
Date 2008-04-04.20:37:56
SpamBayes Score 0.14858255
Marked as misclassified No
Message-id <1207341537.41.0.695666739868.issue2537@psf.upfronthosting.co.za>
In-reply-to
Content
Huh.  Maybe you're right.  JavaScript, Ruby, and Perl all accept both
regexes, although no two agree on what should be captured:

js> "xyyzy".replace(/((x|y)*)*/, "($1, $2)") 
(xyy, y)zy
js> "xyyzy".replace(/((x|y+)*)*/, "($1, $2)")
(xyy, yy)zy

>> "xyyzy".sub(/((x|y)*)*/, "(\\1, \\2)")
=> "(, y)zy"
>> "xyyzy".sub(/((x|y+)*)*/, "(\\1, \\2)")
=> "(, yy)zy"

  DB<1> $_ = 'xyyzy'; s/((x|y)*)*/(\1 \2)/; print
( )zy
  DB<2> $_ = 'xyyzy'; s/((x|y+)*)*/(\1 \2)/; print
( yy)zy

Ruby's behavior seems best to me.
History
Date User Action Args
2008-04-04 20:38:57jorendorffsetspambayes_score: 0.148583 -> 0.14858255
recipients: + jorendorff, mark.dickinson
2008-04-04 20:38:57jorendorffsetspambayes_score: 0.148583 -> 0.148583
messageid: <1207341537.41.0.695666739868.issue2537@psf.upfronthosting.co.za>
2008-04-04 20:37:57jorendorfflinkissue2537 messages
2008-04-04 20:37:56jorendorffcreate