Share via


IPatternMatcherFactory.CreatePatternMatcher Method

Definition

Gets an IPatternMatcher given a search pattern and search options.

public:
 Microsoft::VisualStudio::Text::PatternMatching::IPatternMatcher ^ CreatePatternMatcher(System::String ^ pattern, Microsoft::VisualStudio::Text::PatternMatching::PatternMatcherCreationOptions ^ creationOptions);
public Microsoft.VisualStudio.Text.PatternMatching.IPatternMatcher CreatePatternMatcher (string pattern, Microsoft.VisualStudio.Text.PatternMatching.PatternMatcherCreationOptions creationOptions);
abstract member CreatePatternMatcher : string * Microsoft.VisualStudio.Text.PatternMatching.PatternMatcherCreationOptions -> Microsoft.VisualStudio.Text.PatternMatching.IPatternMatcher
Public Function CreatePatternMatcher (pattern As String, creationOptions As PatternMatcherCreationOptions) As IPatternMatcher

Parameters

pattern
String

Describes the search pattern that candidate strings will be compared against for relevancy.

creationOptions
PatternMatcherCreationOptions

Defines parameters for what should be considered relevant in a match.

Returns

Remarks

This pattern matcher uses the concepts of a 'Pattern' and a 'Candidate' to to differentiate between what the user types to search and what the system compares against. The pattern and some PatternMatcherCreationOptions are specified in here in order to obtain an IPatternMatcher.

The user can then call TryMatch(String) repeatedly with multiple candidates to filter out non-matches, and obtain sortable PatternMatch objects to help decide what the user actually wanted.

A few examples are useful here. Suppose the user obtains an IPatternMatcher using the following: Pattern = "PatMat"

The following calls to TryMatch could expect these results: Candidate = "PatternMatcher" Returns a match containing CamelCaseExact.

Candidate = "IPatternMatcher" Returns a match containing CamelCaseSubstring

Candidate = "patmat" Returns a match containing Exact, but IsCaseSensitive will be false.

Candidate = "Not A Match" Returns null.

To determine sort order, call CompareTo(PatternMatch).

Applies to