function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Trif Cristian 7Trif Cristian 7 

how can i replace <br> with \n

Hello, I have to extract the message from an HTML file... I managed to extract the message but I have the <br> in message in it looks ugly because after i extract the message from HTML file i want to map this to my description field, into Leads. So my message is this:

Goedendag,
<br>
<br>
Ik ben geïnteresseerd in uw BMW 5-Serie met kenteken 5-TFR-74. <br>
Wilt u contact met mij opnemen? <br>
<br>
Met vriendelijke groet,

And i want to remove the <br> and replace it with the new line break which is \n.

Okay, I tried to replace by using replaceAll function from String class and it looks like this:

target.replaceAll('<br>', '\n');
But I have an error.. are there any methods to solve this problem?
Raj VakatiRaj Vakati
You code is correct  .. what is the error your got 


Please try this 
 
String sss ='Goedendag,<br><br>Ik ben geïnteresseerd in uw BMW 5-Serie met kenteken 5-TFR-74. <br>Wilt u contact met mij opnemen? <br><br>Met vriendelijke groet,';
system.debug(sss.replaceAll('<br>', ' /n '));