Way to do do search/replace adding linebreaks?

Is there a way to use the RubyMine editor to replace all commas with actual line breaks?


Hi Chez,

Try this (as far as I understood your request):

  1. Bring replace dialog (for current file (Ctrl+R) or multiple files (Ctrl+Shift+R))
  2. Check that Regex (Regular expression) box is ticked
  3. Type search pattern in "Find" filed (in your case it should be just comma , )
  4. Type replacement pattern: for line break it will be \n
  5. Hit "Replace" or "Replace All"


Yup, that did it. Thank you.


That's not a great solution when the search string is complicated and has lots of things that would be interpreted as part of a regular expression.


What I do for complicated strings:

1. I'll use a normal search and replace to remove what I'm looking for. I should be left with a bunch of linebreaks with nothing else but white space in those areas.

2. I click the regex option and replace using:      \n\s


My problem was a little different but this got me part of the way there. The `,` for the search pattern didn't work for me because mine was copying from Win to OSX. So I have to copy the nl char in the plain-text scratch file then that worked with the rest of the regex stuff. Here is a SS


Please sign in to leave a comment.