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
5 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
Avatar
Permanently deleted user

Yup, that did it. Thank you.

0
Avatar
Permanently deleted user

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

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

0

Please sign in to leave a comment.