Wildcards (Visual Studio)

The following expressions can replace characters or digits in the Find what field of the Visual Studio Find and Replace Window.

To enable the use of wildcards in the Find what field during Quick Find, Find in Files, Quick Replace, or Replace in Files operations, select the Use option under Find Options and then choose Wildcards.

The triangular Expression Builder button next to the Find what field then becomes available. Click this button to display a list of the available wildcards. When you choose any item from the Expression Builder, it is inserted into the Find what string.

Wildcards for Find and Replace

Here are the wildcards available in the Expression Builder.

Expression

Syntax

Description

Any single character

?

Matches any single character.

Any single digit

#

Matches any single digit. For example, 7# matches numbers that include 7 followed by another number, such as 71, but not 17.

Characters not in set

[! ]

Matches any one character that is not specified in the set.

Escape

\

Matches the character that follows the backslash (\) as a literal. This allows you to find the characters used in wildcard notation, such as * and #.

One or more characters

*

Matches zero or more characters. For example, new* matches any text that includes "new", such as newfile.txt.

Set of characters

[ ]

Matches any one of the characters specified in the set.

See Also

Reference

Regular Expressions (Visual Studio)

Quick Find, Find and Replace Window

Quick Replace, Find and Replace Window

Find in Files, Find and Replace Window

Replace in Files, Find and Replace Window

Other Resources

Finding and Replacing