Table of Contents

Class Wildcard

Namespace
SunamoRegex
Assembly
SunamoRegex.dll

Provides wildcard pattern matching built on top of the Regex engine. Cannot be derived directly from Regex because then a wildcard would be passed where a regex is expected. An instance must be created via CreateInstance(string) to ensure proper wildcard-to-regex conversion.

public class Wildcard : Regex, ISerializable
Inheritance
Wildcard
Implements
Inherited Members
Extension Methods

Methods

CreateInstance(string)

Creates a new Regex instance from a wildcard pattern.

public static Regex CreateInstance(string pattern)

Parameters

pattern string

The wildcard pattern to convert and compile.

Returns

Regex

A Regex instance representing the wildcard pattern.

CreateInstance(string, RegexOptions)

Creates a new Regex instance from a wildcard pattern with the specified options.

public static Regex CreateInstance(string pattern, RegexOptions regexOptions)

Parameters

pattern string

The wildcard pattern to convert and compile.

regexOptions RegexOptions

The regex options to apply.

Returns

Regex

A Regex instance representing the wildcard pattern.

IsMatch(string, string)

Determines whether the input string matches the specified wildcard pattern.

public static bool IsMatch(string input, string pattern)

Parameters

input string

The input string to match against.

pattern string

The wildcard pattern using * and ? characters.

Returns

bool

True if the input matches the wildcard pattern; otherwise, false.

WildcardToRegex(string)

Converts a wildcard pattern to an equivalent regular expression.

public static string WildcardToRegex(string pattern)

Parameters

pattern string

The wildcard pattern to convert.

Returns

string

A regex equivalent of the given wildcard pattern.