diff -r 3b9496db3fb9 -r 3390e863d796 progs/catastrophic.rb --- a/progs/catastrophic.rb Tue Sep 26 14:07:29 2017 +0100 +++ b/progs/catastrophic.rb Tue Sep 26 14:08:49 2017 +0100 @@ -2,18 +2,19 @@ nums = (1..1000) -#iterate through the nums 1-100 +#iterate through the nums 1-1000 nums.each do |i| start_time = Time.now string = "a" * i + + #create a new regular expression based on current value of i re_str = "a?" * i + "+" + "a" * i - #create a new regular expression based on current value of i - re = Regexp.new(re_str) re.match(string) - #if re.match(string) + + #if re.match(string) # puts "matched string a * #{i} with regex #{re}" #else # puts "unmatched string a * #{i} with regex #{re}"