Computer >> Computer tutorials >  >> Troubleshooting >> Windows Errors

Find and Replace String/Character/Symbol with a New Line in Notepad++

Notepad++ is a source code and text editor that is mostly used by programmers to edit their codes in an easy environment. This is the advanced version of default Notepad and it supports several languages. There are many features and tools that users can use to edit their source code or text. Sometimes users will require adding new lines in their existing text file. However, there are different options that are required to set before trying to replace them with the new lines. In this article, we will teach you about how you can add new lines in Notepad++ by using the Find and Replace tool.

Find and Replace String/Character/Symbol with a New Line in Notepad++

Replacing String/Character/Symbol with a New Line

Depending on the type of text or source code, it may have different strings, characters, or symbols. There are different reasons that a user will require adding new lines after a specific string in Notepad++. The find and replace in Notepad++ is similar to the most text editors that provide this tool. However, there are some extra options within the Notepad++, which can help in identifying different kinds of characters or symbols. We are going to use the replace all option in the below steps, however, you can also use the find next and replace a single string for a new line. You can follow the below steps to try it out:

  1. Open Notepad++ by double-clicking on the shortcut or searching it through the Windows search feature.
  2. Click on the File menu in the menu bar, choose the Open option to open an existing file, or choose the New to create a new file, and add text in it.Find and Replace String/Character/Symbol with a New Line in Notepad++
  3. Now click on the Search menu in the menu bar and choose the Replace option. You can also hold the Ctrl key and press H to open the Replace window through shortcut keys.Find and Replace String/Character/Symbol with a New Line in Notepad++
  4. For the string, add the word in ‘Find what‘ box and replace it by adding the ‘\r\n‘ before or after the word as shown below. Make sure you select the Extended for Search Mode.
    Note: You can also only use the ‘\n‘ rather than using the ‘\r\n‘.

    Find and Replace String/Character/Symbol with a New Line in Notepad++
  5. Click on the Replace All button to add new lines before or after the string, depending on where you want the new lines.
  6. For the symbol, you just need to add the symbol in the first box and again add the next line command with a symbol in the second box. Click on the Replace All button.Find and Replace String/Character/Symbol with a New Line in Notepad++
  7. Now for the character, add the character in the first box of Replace tab and the new line command with character in the second box as shown below. Then click the Replace All button to add new lines before the character. Make sure you select Match case and Match whole word only options.Find and Replace String/Character/Symbol with a New Line in Notepad++