Search code examples
regexdxf

(Regular Expressions) 2Liner→1Liner


Thank you in advance and sorry for the bad english!

I want

'Odd rows' 'CRLF' 'Even rows' CRLF' → 'Odd rows' ',' 'Even rows' 'CRLF'

Example Input:

  0
SECTION
  2
HEADER

Desired Output:

  0,SECTION
  2,HEADER

What I have tried:

Find: (.*)\n(.*)\n
Replace: $1,$2\n

I want ー Easy to see dxf


Solution

  • For you example data you could capture one or more digits in capturing group 1 followed by matching a newline.

    In the replacement use group 1 followed by a comma.

    Match

    (\d+)(?:r?\n|\r)

    Regex demo

    Replace

    $1,