2

I have hundred of song lyric database files, and I need to do something like this,

from this :

 PPK4: B'rilah Hormat Pada Hu
 Judul Inggris: Glory to God in the Highest
 Lagu: unknown Syair: unknown
 1=A, 4/4

to become like this :

PPK4: B'rilah Hormat Pada Hu
B'rilah Hormat Pada Hu
Judul Inggris: Glory to God in the Highest
Lagu: unknown Syair: unknown
1=A, 4/4

PPK4 is a song number. so, there will be like PPK1 until PPK255, KPPK1 .. KPPK300 etc. and same format, "#songcode" ":" "(space)" "song title" "CRLF"

How do I do it using Find and Replace?

user3095679
  • 51
  • 1
  • 1
  • 4

1 Answers1

1

The answer involves regular expressions. You could try "([A-Z]+[0-9]+[:])(.*)" This will capture the song number as group 1 and the song title as group 2. You can then replace this with "\1\2\n\2", i.e. group 1 followed by group 2, a newline and group 2 again.

Example Notepad++ Screenshot

FRob
  • 3,883
  • 2
  • 27
  • 40
Pankaj Jaju
  • 5,371
  • 2
  • 25
  • 41
  • 1
    You can also try "([A-Z]+[0-9]+:)[ ]?(.*)" as the search string and "\1 \2\n\2" as the replacement string. This will get rid of the initial space in front of the song title that Pankaj's expression captured and duplicated (see screenshot). With this solution, a missing space after the colon would be corrected as well. – FRob Dec 12 '13 at 15:00
  • @Thanks FRob - You made it easier to understand – Pankaj Jaju Dec 12 '13 at 15:00
  • thanks FRob & Pankaj Jaju. u ve help me alot. – user3095679 Dec 13 '13 at 00:56