1

Transform

Source: This is source 1
Description : This is the description of source 1
Source: This is source 2
Description : This is a description of source 2

into this:

Description : This is a source 1: This is the description of source 1
Description : This is a source 2: This is the description of source 2

All the examples I have seen append line 2 to line 1 like this:

(^Source.*$)(\r\n)
\1

I need to append line 1 to line 2, and line 3 to line 4 etc.

C0ppert0p
  • 123
  • 1
  • 3
  • 10

1 Answers1

2
  • Ctrl+H
  • Find what: ^Source(:.+)\R(Description\h+)
  • Replace with: $2$1
  • CHECK Match case
  • CHECK Wrap around
  • CHECK Regular expression
  • UNCHECK . matches newline*
  • Replace all

Explanation:

^                   # beginning of line
  Source            # literallly
  (:.+)             # group 1, colon and 1 or more any character but newline
  \R                # any kind of linebreak (i.e. \r, \n, \r\n)
  (                 # group 2
    Description     # literally
    \h+             # 1 or more horizontal spaces
  )                 # end group 2

Replacement:

$2              # content of group 2
$1              # content of group 1

Screen capture (before):

enter image description here

Screen capture (after):

enter image description here

Toto
  • 19,304