stuckwithcode Posted January 14, 2010 Share Posted January 14, 2010 Hello, the code below will replace the word hello with a line break. text = text.replace(/hello/gm,"\n"); Just out of curiosity could someone please tell me how I would replace hello with the text \n not the line break. Thanks Quote Link to comment Share on other sites More sharing options...
salathe Posted January 14, 2010 Share Posted January 14, 2010 You simply need to escape the backslash: "\\n" Quote Link to comment Share on other sites More sharing options...
stuckwithcode Posted January 14, 2010 Author Share Posted January 14, 2010 Thanks I thought it would be simple. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.