Use regular expressions in Visual Studio to quickly find and replace

Source: Internet
Author: User

The find-replace in Visual Studio can use a regular expression:

 

Example:

 

From:

 

 

# Define ds_min_error 0

# Define ds_error 0

# Define ds_download_error 1

# Define ds_db_download_error 2

# Define ds_fd_init_error 3 // cfiledownload init Error

# Define ds_db_init_error 4 // cfiledownload: dbinfo init Error

# Define ds_max_error 99

 

# Define ds_db_complete 100

# Define ds_download_complete 101

 

 

# Define ds_fd_raw 200 // cfiledownload initialization status

# Define ds_fd_waiting 201 // fd_waiting

# Deprecision ds_fd_downloading 202

 

 

# Define ds_write_file 300

# Define ds_db_write_file 301

 

# Define ds_relocation 400

 

 

Changed:

 

 

Ds_min_error = 0;

Ds_error = 0;

Ds_download_error = 1;

Ds_db_download_error = 2;

Ds_fd_init_error = 3; // cfiledownload init Error

Ds_db_init_error = 4; // cfiledownload: dbinfo init Error

Ds_max_error = 99;

 

Ds_db_complet = 100;

Ds_download_complete = 101;

 

 

Ds_fd_raw = 200; // cfiledownload initialization status

Ds_fd_waiting = 201; // fd_waiting waits for the download to start.

Ds_fd_downloading = 202;

 

 

Ds_write_file = 300;

Ds_db_write_file = 301;

 

Ds_relocation = 400;

 

 

In the replace menu, enter:

 

Find what:

/# Define {[: C _] +}: B + {: D +}

 

Replace:

/1 =/2;

 

Note: In find options, select:

Use:

Regular Expression

 

 

Regular Expression in Microsoft:

Http://msdn.microsoft.com/en-us/library/2k3te2cs (vs.80, IDE). aspx

 

This regular syntax is not the same as what we are familiar with, such as {},: C: d

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.