Question: i have a string where there is no space in between and there is a set of characters which keeps on repeating in the same string, but i want to replace those set of characters with `\n`. here is what i have tried but i'm not able to see anything

here is the string 

```
lorem%20ipsum%20skdjajsadsa%0D%0Askdjsadkasjdkjasdsjds%0D%0Aadasdkjsadkjsad%0D%0Aaki7yuj%0

```

in the string there are 3 occurrences of `%0D%0A`, i want to replace those with `\n`, how can i do this

here is what i have tried.

```js
str = "lorem%20ipsum%20skdjajsadsa%0D%0Askdjsadkasjdkjasdsjds%0D%0Aadasdkjsadkjsad%0D%0Aaki7yuj%0"

console.log(
  str.replace("%0D%0A", "\n")
);
```

Answer: 
You can use RegEx with the global flag [`g`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Parameters) to remove all occurrences:

```js
var str = "lorem%20ipsum%20skdjajsadsa%0D%0Askdjsadkasjdkjasdsjds%0D%0Aadasdkjsadkjsad%0D%0Aaki7yuj%0"

str = str.replace(/%0D%0A/g, "\n");
console.log(str);
```
Try

```js
let str = "lorem%20ipsum%20skdjajsadsa%0D%0Askdjsadkasjdkjasdsjds%0D%0Aadasdkjsadkjsad%0D%0Aaki7yuj%0"

let r= str.replace(/(%0D%0A)/g,"\n");

console.log(r);
```