Search code examples
regexnotepad++txtextcontrol

How to move ip adresses to the end of line in Notepad++


I have the data as follows in txt:

136.40.226.97|ubnt|ubnt|
138.197.81.94|listd|54e172662|
138.68.254.243|wordpress|wordpress|
139.162.55.12|public|public|
139.60.58.136|system|OkwKcECs8qJP2Z|

I want to convert it to this:

|ubnt|ubnt|136.40.226.97
|listd|54e172662|138.197.81.94
|wordpress|wordpress|138.68.254.243
|public|public|139.162.55.12
|system|OkwKcECs8qJP2Z|139.60.58.136

Solution

  • In Find and Replace window Ctrl+H change Search Mode to Regular expression and set:

    Find what: (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(.*)
    Replace with: (\2)(\1)

    This will find too groups: IP(1), rest of line(2), then Replace writes them in inverted order.