From: Joel Pearson Date: 2012-12-29T09:45:41+09:00 Subject: Re: "unless" with Regex This will give you exactly 4 digits: if year =~ /^\d{4}$/ -- Posted via http://www.ruby-forum.com/.