Using wildcard search and replace in Notepad++

notepad

Basically I have the following in Notepad++:

|RD1-team01=
|RD1-team02=
|RD1-team03=
|RD1-team04=

… and so on. And I want to use the wildcard to add a space before the equals sign (=). There are numerous other equals signs in the document, so I cannot use find and replace. How can I do this in Notepad++?

Best Answer

You could use a regular expression.

Follow these steps on notepad++:

  1. Ctrl+f
  2. click on 'replace' tab
  3. on 'find what' the following: ^\|RD1\-team(..)\=
  4. on 'replace with' enter the following: \|RD1\-team$1 \=
  5. on the 'search mode' box on the lower left corner be sure to select 'Regular Expression' AND uncheck '. matches new line'
  6. finally click 'replace all'

Note: this specific regular expression (regex) will look for the first occurrence of "|RD1-teamXX=" in a line and only add the space to that specific segment.

For example this line:

|RD1-team04=|RD1-team01=test

became:

|RD1-team04 =|RD1-team01=test