Search code examples
rubymine

Replacing a string in Rubymine with a string with newlines


I want to use the Search and Replace dialogue in Rubymine, or something similar to replace something like "Scenario:" with "@Desktop\nScenario"

I'm trying to replace every instance of Scenario: in a large Cucumber test suite with

@desktop 
Scenario:

Any best ways to do this?


Solution

  • Update:

    Thanks to @ryan2johnson9 comment, I realise there's now an easier option (tested on 2017.3).

    By clicking on the "New Line" (or using the shortcut Ctrl+Shift+Enter / Alt+Enter), the input becomes multilines.

    New line Multiline


    Original Answer

    In the search and replace box, if you tick the "Regex" option you can do:

    Search: "Scenario:" Replace by: "@desktop\nScenario:"

    The only trick is to tick the "Regex" option :)