Fixed regular expressions so they would work on Ruby 1.8.7.