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?

4
4 comments

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"

9

Yup, that did it. Thank you.

0

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.

-3

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

0

Please sign in to leave a comment.