author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Fri, 18 Apr 2014 21:05:07 +0100 | |
changeset 226 | e3c454e31224 |
parent 225 | ef573e8fc86e |
child 227 | 93bd75031ced |
progs/re.rb | file | annotate | diff | comparison | revisions |
--- 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)