Fixed regex.rb and added some tests