From: "Pierre-Andre M." Date: 2012-12-29T09:38:56+09:00 Subject: "unless" with Regex I have a series of folders in a directory that I am trying to read out of...I want to do a regex that ignores anything EXCEPT 4 digit numbers (as in a proper year)...I tried using the "unless" option but doesnt seem to be working: unless !/\d{4}/ Here is the code-snippet Dir.foreach("/Volumes/gac_repo/video") do |year| #unless the folder name isnt a 4 digit number... unless !/\d{4}/ #print the name of the folder which hopefully should just be years puts "The folder name is: #{year}" #Do stuff to the files inside of the folders Dir.foreach("/Volumes/gac_repo/video/#{year}") do |name| puts "The file name is #{name}" end end end -- Posted via http://www.ruby-forum.com/.