From: Alan Munn Date: 2009-07-21T04:30:06+09:00 Subject: including newlines in a .sub Hi, I'm new to ruby, and am having trouble with the following (\n is newline on a Mac). e.g. line = "foo bar" line = line.sub(/ /, '\n') puts line This produces: foo\nbar when what I want (and expected) was: foo bar (This is just a toy example; I don't actually want to split lines on spaces.) What I don't understand is how to insert a true newline into a string so that it outputs as such. Thanks Alan