# How to tell the difference between \\n in a string and a newline?

**URL:** <https://discourse.nodered.org/t/how-to-tell-the-difference-between-n-in-a-string-and-a-newline/77922>\
**Category:** General\
**Tags:** function-node\
**Created:** [25 April 2023 14:09 UTC](https://discourse.nodered.org/t/how-to-tell-the-difference-between-n-in-a-string-and-a-newline/77922 "2023-04-25T14:09:00Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [25 April 2023 15:05 UTC](https://discourse.nodered.org/t/how-to-tell-the-difference-between-n-in-a-string-and-a-newline/77922/9 "2023-04-25T15:05:54Z")

</div>

Try

```auto
let lines = file.split(/(?<!:)\n/)

```

But it would be best to correct the code and remove non valid property characters from your property names, then you would not have to patch the issue.

Just for info

```auto
const foo = file.replace( ":\n", ":::")

```

will only replace first occurance.  
it should be

```auto
const foo = file.replace( /:\n/g, ":::")

```

for multiple replaces.

---

_[View the full topic](https://discourse.nodered.org/t/how-to-tell-the-difference-between-n-in-a-string-and-a-newline/77922)._
