12

How to find and delete all the line breaks? I tried \n and it doesn't work! Regular expression? what kinda of expression?

randomor
  • 5,329
  • 4
  • 46
  • 68
  • Found out the answer in textmate irb channel: option return to search literal line breaks in the find and replace panel, \n works in the regex search and won't work in literal search mode. – randomor Aug 04 '11 at 18:12
  • 1
    Since you found out, answer your own question and then accept it. – Zach Inglis Aug 04 '11 at 18:45

3 Answers3

23

I found the answer in the TextMate IRC channel.

Press Option Return to search for literal line breaks in the Find and Replace panel.

Searching for \n works if you select the "Regular Expression" option, but won't work in the literal search mode.

pkamb
  • 33,281
  • 23
  • 160
  • 191
randomor
  • 5,329
  • 4
  • 46
  • 68
6

Without regex (regular search):

Alt + ⏎
laffuste
  • 16,287
  • 8
  • 84
  • 91
0

Select the empty space in between the lines and Copy. Then Select the block of text you want to remove line breaks from. Go to Find & Replace. Paste the copied empty space in the Find field. Type a space in the Replace field. Hold Option, which toggles Replace All to In Selection, then click In Selection. This should do the trick.

addzies
  • 49
  • 4