10

I often have to replace multiple lines in multiple documents. In Visual Studio 2012 there seems to be the possibility to put muliple line code in a simple one-line-input-box only.

search/replace box layer in Visual Studio 2012 (german language pack)

In the "embedded" search box there is also only a single-line input field: embedded search/replace box in Visual Studio 2012 (german language pack)

After inserting the often very long search terms and trying to put a regular expressions for line breaks into it, i have to move horizontally inside a one-line-input-field which isn't comfortable at all.

Is there another way to use the find/replace functionality for replacing muliple lines in Visual Studio 2012?

2
  • 1
    I doubt it. There hasn't been on any previous version of Visual Studio. For all the times you need to use multiple-line blocks of text, why don't you just use the larger dialog? (See also here for a macro-based solution that gives you a custom find/replace dialog.) Mar 11, 2013 at 12:19
  • In the meantime someone recommended me this (seems to be more UX-friendly than using RegEx): helixoft.com/blog/… Sep 16, 2014 at 11:38

2 Answers 2

10

In order to replace multiple lines first you have to check regular expression option on search window. In following example it's search the

   first
   second
   third

and replace it with

  fourth
  fifth
  sixth

search text : first([\s\n])second([\s\n])third

replace text : fourth$1fifth$2sixth

find replace example

1
  • This helped me to replace one line with many by capturing the new line at the end and using it several times in the Replace with string.
    – Segfault
    Jan 17, 2014 at 20:35
0

This worked exceptionally well for me:

http://vlasovstudio.com/sync-block-edit/

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.