Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiline Find & Replace in Visual Studio

Can it be done? We're using VS2005 and VS2008 and VS2010.

I don't mean regular expressions - which have their place - but plain old text find & replace. I know we can do it (at a pinch) with regular expressions using the \n tag but prefer not to get tangled up in regex escape characters, plus there's a readability issue.

If it can't be done what plain and simple (free) alternative are people using? That doesn't involve knocking up our own macro.

like image 707
hawbsl Avatar asked Feb 16 '10 14:02

hawbsl


People also ask

How do I find and replace multiple lines?

CHANGE: The default keyboard shortcut for “Multiline Find/Replace” was Ctrl+Alt+F but it was not applied because this shortcut was already taken by “F# Interactive”. So, the new default shortcut is Ctrl+M, Ctrl+F.

Where is find and replace in Visual Studio 2019?

You can find and replace text in the Visual Studio editor by using Find and Replace (Ctrl+F or Ctrl+H) or Find/Replace in Files (Ctrl+Shift+F or Ctrl+Shift+H). You can also find and replace only some instances of a pattern by using multi-caret selection.


1 Answers

I finally found it..

No need to download and load any external macro.

Its working in Visual Studio 2008 with in-built macro at least. :)

Steps :
1) Select text you want to find.
2) Press "Alt+F8" or open "Tools -> Macros -> Macro Explorer"
3) Double click "Sample -> Utilities -> FindLine". (It will open Find box with your selection loaded in "Find" field. Don't worry about truncated text shown in "Find" field. Trust me, field has it all..MS way of showing it may be... :) )
4) Click on "Quick Replace" button on "Find And Replace" dialog box. Enter your replace with text.
5) And Click any of 3 buttons as per your requirement...and its done. :)

Hurray.. its working.. May not be a straight forward way to do it but you know with MS.. nothing is straightforward and easy.. :)

like image 136
SV. Avatar answered Sep 21 '22 19:09

SV.