On Fri, 29 Sep 2006, MonkeeSage wrote:

> eden li wrote:
>> irb(main):001:0> Timeout.timeout 5 do ("a"*300)+"b" =~ /^(a*)*$/ end
>
> Hmm...is that a valid expression? Capture "a" zero or more times, and
> then repeat that capture zero or more times?! What exactly does that
> mean?
>
> perl5 runs it but finds no match:
>
> ("a" x 300) . "b" =~ /^(a*)*$/
>
> python spits out an error:
>
> import re
> s = ("a"*300)+"b"
> re.search(r'^(a*)*$', s)
>
> # ...
> #   raise error, v # invalid expression
> # sre_constants.error: nothing to repeat
>
> And ruby 1.9. runs it but finds no match (same as perl).
>
> So I think that the expresion is broken and ruby 1.8 has a bug.
>
> Regards,
> Jordan

i've been running it for hours - still hasn't exited... but it does seem
valid:

   irb(main):003:0> 'aaaa'[ %r/^(a*)*/ ]
   => "aaaa"

interesting...


-a
-- 
in order to be effective truth must penetrate like an arrow - and that is
likely to hurt. -- wei wu wei