File Path Patterns

Some of CodeIt.Right and GhostDoc options, such as Solution Ignore List and Analyze Specific Files, use file search patterns to tell our products which solution files to use and which to ignore. File patterns follow the same rules the Operators.LikeString method in C# or the Like operator in Visual Basic.

The "root directory" in file patterns is the solution directory - the directory where the <solution>.sln file resides.

A path pattern looks like a path, but it can contain some special parts:

Characters in pattern Matches in string
* Matches zero or more characters. For example a*c matches to abc, axyzc and ac
? Matches exactly one character. For example a?c matches to abc, but not axyzc or ac or a\c
# Matched any single digit (0–9)
[charlist] Matches any single character in charlist
[!charlist] Matches any single character not in charlist

See this Microsoft article for more details and examples.

Examples

*.min.js when in the ignore list will exclude all minimized JavaScript files
*jquery*.js when in the ignore list will exclude all versions of the jQuery libraries
UnitTest\* when in the ignore list will exclude all files within the UnitTest folder

Character Lists

A group of one or more characters (charlist) enclosed in brackets ([ ]) can be used to match any single character in string and can include almost any character code, including digits.

An exclamation point (!) at the beginning of charlist means that a match is made if any character except the characters in charlist is found in string. When used outside brackets, the exclamation point matches itself.

Special Characters

To match the special characters left bracket ([), question mark (?), number sign (#), and asterisk (*), enclose them in brackets. The right bracket (]) cannot be used within a group to match itself, but it can be used outside a group as an individual character.

The character sequence [] is considered a zero-length string (""). However, it cannot be part of a character list enclosed in brackets. If you want to check whether a position in string contains one of a group of characters or no character at all, you can use Like twice. For an example, see How to: Match a String against a Pattern (Visual Basic).

Character Ranges

By using a hyphen () to separate the lower and upper bounds of the range, charlist can specify a range of characters. For example, [A–Z] results in a match if the corresponding character position in string contains any character within the range A–Z, and [!H–L] results in a match if the corresponding character position contains any character outside the range H–L.

When you specify a range of characters, they must appear in ascending sort order, that is, from lowest to highest. Thus, [A–Z] is a valid pattern, but [Z–A] is not.

Multiple Character Ranges

To specify multiple ranges for the same character position, put them within the same brackets without delimiters. For example, [A–CX–Z] results in a match if the corresponding character position in string contains any character within either the range A–C or the range X–Z.

Usage of the Hyphen

A hyphen () can appear either at the beginning (after an exclamation point, if any) or at the end of charlist to match itself. In any other location, the hyphen identifies a range of characters delimited by the characters on either side of the hyphen.

Add Feedback