progs/re.rb
changeset 226 e3c454e31224
parent 121 43c116860e47
--- 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)