A stupid Xcode trick, for find and replace with carriage returns

I’m really proud of this new trick, which means I’m getting down and dirty with work it’s obvious I haven’t been fly fishing in a while.

I was taking a look at a pretty complex CSS file, but the whole thing sits on a single line. There were no carriage returns, so analysis was a pain in the butt. More like impossible. I’m a bonafide moron when it comes to REGEX, but I really wanted some returns in there.


I knew each line should end with a closing bracket ( } ), so I added a \n using find and replace.


Now want to turn those \n into real breaks. I look for \n, and in the replace box I hit [Control-Q] followed by the [Return] key. Note that nothing shows up in the replace box, but XCode knows the commands are there (why I’ll never know – I’m a moron in that department too). Then I click on Replace All.



Editor’s note: This guy really needs some time on the water.


Sounds like you need to replace those xcodes with a fly rod and go find and replace some trout!

You can say that again. But if I utilize my latest stupid trick with otherworldly speed and efficiency today, I might just take the day off tomorrow. Emphasis on “otherworldly” and “might”.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.