A
Aa Wilson
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 '<br />',
while preserving the line ends. The catch is that I don't want to gsub
anything that looks like '<br />\r\n' or '<br />\n', to prevent my gsub
from inserting breaklines on subsequent edits of this string. I've
tried gsub with the regex /(?!<br\s*\/>)($)[^\z]/, but haven't had any
luck getting it to match. For example, on the string
"test\r\ntest<br>\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.
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 '<br />',
while preserving the line ends. The catch is that I don't want to gsub
anything that looks like '<br />\r\n' or '<br />\n', to prevent my gsub
from inserting breaklines on subsequent edits of this string. I've
tried gsub with the regex /(?!<br\s*\/>)($)[^\z]/, but haven't had any
luck getting it to match. For example, on the string
"test\r\ntest<br>\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.