Home > 2012, Visual Studio > Visual Studio 2012: All about the Quick Find and Replace Feature

Visual Studio 2012: All about the Quick Find and Replace Feature


Introduction

This is the first post of a 30 post series that covers futures in Visual Studio 2012 and TFS 2012. Posts will range from beginner to advance level.

Quick Find

In this post I will try to cover everything you can do with the Find/Find and Replace feature in Visual Studio. I will be using Visual Studio 2012 in my examples.

We can launch the Quick Find box by either the Ctrl+F keyboard shortcut or click on Edit —> Find and Replace –> Quick Find. The quick find feature, highlights the text or expression you are trying to find

The following window shows up on top right corner of the opened document. The next bullets explains each label section do

image

1. The textbox where you type the word or the expression you are trying to find

2. Match case: It means if you are trying to ABC, you won’t find abc or Abc within the results

3. Match whole word: If selected, text or expression will be match against words. For instance, lets say you are looking for BC. ABCD, BCD, ABC, …etc will not be within your results.

4. Use regular expression: when selected, you can search using regular expression syntax. For example, I want to find the numbers between 0 and 9 and at the same time I want to find all text the contains the word “status”. I can use the following regex “[0-9]|status” without the quotes, and the text will be highlighted

image

5. Drop down to specify the scope of the search.

6. Toggle between Find and Find and Replace modes.

7. image Find the next match.

8. image Clicking on the chevron, allows you to find the next match, previous match or all matches. Find all matches shows results in the “Find Results” window

Note, if no matches found, the border of textbox becomes red

image

Replace

To replace matched text

1. Click on the “Toggle between Find and Find and Replace modes”, point number 6 above

2. I am going to replace the a typo I had in my code; replace the word Statsu with Status

image

3. Click the “a” button if you want to replace the next occurrence of the matched text

4. Click the “b” button if you want to replace all occurrences of the matched text in the selected scope (Current Document, project, solution …etc)

Next Post will be about the Find in Files feature

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: