FileSystemName.MatchesWin32Expression Method

Definition

Verifies if the given Win32 expression matches the given name. Supports the following wildcards: '*', '?', '<', '>', '"'. The backslash character '\' escapes.

public static bool MatchesWin32Expression (ReadOnlySpan<char> expression, ReadOnlySpan<char> name, bool ignoreCase = true);
static member MatchesWin32Expression : ReadOnlySpan<char> * ReadOnlySpan<char> * bool -> bool
Public Shared Function MatchesWin32Expression (expression As ReadOnlySpan(Of Char), name As ReadOnlySpan(Of Char), Optional ignoreCase As Boolean = true) As Boolean

Parameters

expression
ReadOnlySpan<Char>

The expression to match with, such as "*.foo".

name
ReadOnlySpan<Char>

The name to check against the expression.

ignoreCase
Boolean

true to ignore case (default), false if the match should be case-sensitive.

Returns

true if the given expression matches the given name; otherwise, false.

Remarks

The syntax of the expression parameter is based on the syntax used by FileSystemWatcher, which is based on RtlIsNameInExpression, which defines the rules for matching DOS wildcards ('*', '?', '<', '>', '"').

Matching will not correspond to Win32 behavior unless you transform the expression using TranslateWin32Expression(String).

Applies to