From: "Peña, Botp" Date: 2007-08-06T10:57:26+09:00 Subject: Re: Doubts on char patterns into String.each argument On Behalf Of Carlos Ortega: # and it says that the ' ' is just one of the White Characters # that '\s' may represent ( the other ones are TAB and NEW LINE) careful with "" vs '' irb(main):020:0> puts "\s" => nil irb(main):021:0> puts '\s' \s => nil irb(main):022:0> irb(main):023:0* p "\s" " " => nil irb(main):024:0> p '\s' "\\s" => nil careful with "\s" vs /\s/ vs '\s' irb(main):013:0> " \t\n*\n".split("\s*") => [" \t\n*\n"] irb(main):014:0> " \t\n *\n".split("\s*") => [" \t\n", "\n"] irb(main):015:0> " \t\n *\n".split("\s") => ["*"] irb(main):016:0> " \t\n *\n".split(/\s*/) => ["", "*"] irb(main):017:0> " \t\n *\n".split(/\s/) => ["", "", "", "", "*"] irb(main):018:0> " \t\n *\n".split(/\s+/) => ["", "*"] irb(main):019:0> " \t\n *\n".split('\s*') => [" \t\n *\n"] irb(main):020:0> " \t\n *\n".split('\s') => [" \t\n *\n"] irb(main):043:0> "Substring1\t\n Substring2\tSubstring3".each( "\s" ) { | substring | irb(main):044:1* puts "[" + substring +"]" irb(main):045:1> } [Substring1 ] [Substring2 Substring3] read on string.each, string.split, string.scan try, $> qri string.each string.split string.scan btw, your 2 sample codes do not differ but on your believed output :( it might be better if you cutnpaste actual code run. kind regards -botp