Fixed the expressions to compare characters correctly in older versions of ruby.