List Info

Thread: Timeout and Exponetial Regexes




Timeout and Exponetial Regexes
user name
2006-09-28 17:55:09
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


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )