From: Aa Wilson Date: 2009-04-10T08:03:25+09:00 Subject: regex woes with breaklines Hello, all. I've been banging my head against this for a little bit, and I'm no closer to a solution. The issue is that I have a string where I would like to gsub all line ends ('\n' or '\r\n') into '
', while preserving the line ends. The catch is that I don't want to gsub anything that looks like '
\r\n' or '
\n', to prevent my gsub from inserting breaklines on subsequent edits of this string. I've tried gsub with the regex /(?!)($)[^\z]/, but haven't had any luck getting it to match. For example, on the string "test\r\ntest
\r\ntest", it will match both of the '\r\n' sets, instead of only the first one (which would be optimal). Thanks in advance for your time. -- Posted via http://www.ruby-forum.com/.