re-internal.rb
author Christian Urban <urbanc@in.tum.de>
Mon, 05 Nov 2012 20:31:58 +0000
changeset 58 f516892da470
parent 57 0c96b2c04591
child 60 68d664c204d2
permissions -rw-r--r--
tuned

# provided by Daniel Baldwin

nums = (1..100)

#iterate through the nums 1-100
nums.each do |i|

	start_time = Time.now
	string = "a" * i

	#create a new regular expression based on current value of i
	re = Regexp.new(/((a?){#{i}})(a{#{i}})/)

	if re.match(string)
		puts "matched string  a * #{i} with regex #{re}"
	else
		puts "unmatched string a * #{i} with regex #{re}"
	end
	
	puts "in = #{(Time.now - start_time) * 1000} milliseconds"
end