Skip to main content

Recently, I've needed to format a javascript file saved from the web which all code were in one single line.

The solution was to find all ";" characters and replace them with "; new line". Luckily, I had installed Notepad++ text editor on the computer.

Here are instructions how to replace characters with new line using Notepad++ text editor.

- Advertisement -
- Advertisement -

1) Open a file with Notepad++

2) Go to Search > Replace... (or use CTRL+F shortcut)

3) Select Replace tab

4) In the section Search Mode select Extended (\n, \r, \t, \0, \x...) option

5) Enter Find what value, e.g. ;

6) Enter Replace with value, e.g. ;\r\n

"\r\n" represents the code for carriage-return in Windows environment. "\r" means "Carriage Return, or 'Return the carriage/cursor to the beginning of the line'" and "\n" means "Advance the carriage/cursor forward one line". In GNU Linux / Unix world code for new line is just "\n".

7) Click Replace All button

- Advertisement -