Swap order of text using notepad++

notepad

I'm not sure how to describe what I'm asking in the title alone.

Ok so I have a HUGE list I'm entering into a SQL DB with a custom program. It imports the items from pastebin. However, I completely spaced how the info needed to be ordered.

So here is a small list example

M9; 15002
M9 Mag; 15101
FiveSeven; 15003
FiveSeven Mag; 15110
MP443; 15004
MP443 Mag; 15109

What I want to know if it's even possible is to have notepad++ take the text and make it like this

15002; M9; 
15101; M9 Mag; 
15003; FiveSeven; 
15110; FiveSeven Mag; 
15004; MP443; 
15109; MP443 Mag; 

I can manually if need be remove the trailing extra ; at the end of each line.

Best Answer

In Notepad++ press CTRL+H

  • Find what: (^.*); (.*?$)
  • Replace with: \2; \1;
  • Check Regular expression option

Before                                       After

enter image description here enter image description here

The trick is to use two capture groups via ( ) and access them with \1 and \2. But in reversed order

Related Question