➜

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.

作者 jorendorff
收信人 jorendorff, mark.dickinson
日期 2008-04-04.20:37:56
SpamBayes Score 0.14858255
Marked as misclassified 否
Message-id <1207341537.41.0.695666739868.issue2537@psf.upfronthosting.co.za>
In-reply-to
内容
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.
历史
日期 用户 动作 参数
2008-04-04 20:38:57jorendorff修改spambayes_score: 0.148583 -> 0.14858255
recipients: + jorendorff, mark.dickinson
2008-04-04 20:38:57jorendorff修改spambayes_score: 0.148583 -> 0.148583
messageid: <1207341537.41.0.695666739868.issue2537@psf.upfronthosting.co.za>
2008-04-04 20:37:57jorendorff链接issue2537 messages
2008-04-04 20:37:56jorendorff创建