[RegEx] Combining multiple lines into one


I was trying to use RegEx to combine the following lines in Atom


into something like:


I used the following commands:

Find: ([0-9][0-9])\R([0-9][0-9])\R([0-9][0-9])
Replace: $1:$2:$3

However, even though I could successfully identify all those 3-line instances, the replacement doesn’t work…

Is there any suggestion on how to do this with RegEx?

Thank you very much!

Find: (\d{2})\n(\d{2})\n(\d{2})
Replace: $1:$2:$3

I think the key-change is replacing \R with \n, then your pattern will work as well. To be honest, I’ve never seen a capital \R – what is supposed to do?

1 Like

Thank you for your suggestion!

(\d{2})\n(\d{2})\n(\d{2}) doesn’t seem to work.

\R means line break. My initial code ([0-9][0-9])\R([0-9][0-9])\R([0-9][0-9]) identifies the relevant patterns, but the replacement doesn’t work well…

(The replacement doesn’t work…)



Are you not confusing this with the lowercase \r? That’s for carriage return, but not for actual line-break. MS-DOS and Windows both use CR+LF by default, so the combination \r\n is commonly used on these platforms.

1 Like

Thank you very much!

I found that I need to use \r\n instead of just \n to make the command work on my laptop.


I really appreciate your help. :slight_smile:

1 Like