0

I have long list of two string in every row, numerical string and alphanumerical string (that are of different length in every raw), that I want to change (switch) position:

010110,file_1.txt
0120100,file_11.txt

To have this:

file_1.txt,010110
file_11.txt,0120100

Second string also include dots and underscores, as in example above. I tried regex that I used before for similar task but it doesn't work, I tried in Notepad++ and Powergrep.

([^_]*),(.*)

Replace with:

\2_\1

Tried that regex (with variations) but didn't have result.

Jim8645
  • 181
  • 3
  • 15

2 Answers2

5

I'd do:

  • Find what: ^([^,]+),(.+)$
  • Replace with: $2,$1
  • Replace all
Toto
  • 89,455
  • 62
  • 89
  • 125
1

Use a reluctant quantifier *?:

Find: ^(.*?),(.*)
Repl: $2,$1

.*? matches as little as possible.

Bohemian
  • 412,405
  • 93
  • 575
  • 722