# HG changeset patch # User Christian Urban # Date 1397851507 -3600 # Node ID e3c454e3122420425896348908b8b93003bb1c24 # Parent ef573e8fc86e631227753f6a01ba0b7ce30f2899 updated so that it works with more recent versions of Ruby diff -r ef573e8fc86e -r e3c454e31224 progs/re.rb --- a/progs/re.rb Tue Dec 10 17:48:15 2013 +0000 +++ b/progs/re.rb Fri Apr 18 21:05:07 2014 +0100 @@ -1,15 +1,16 @@ # provided by Daniel Baldwin -nums = (1..100) +nums = (1..1000) #iterate through the nums 1-100 nums.each do |i| start_time = Time.now string = "a" * i - + re_str = "a?" * i + "+" + "a" * i #create a new regular expression based on current value of i - re = Regexp.new(/((a?){#{i}})(a{#{i}})/) + + re = Regexp.new(re_str) re.match(string) #if re.match(string)