Class wildex
Parses and compares wildcard expression.
public class wildex
Remarks
Used in "find" functions. For example in wnd.find to compare window name, class name and program. The "find" function creates a wildex instance (which parses the wildcard expression), then calls wildex.Match for each item (eg window) to compare some its property text.
Examples
//This version does not support wildcard expressions.
Document Find1(string name, string date) {
return Documents.Find(x => x.Name.Eqi(name) && x.Date.Eqi(date));
}
//This version supports wildcard expressions.
//null-string arguments are not compared.
Document Find2(string name, string date) {
wildex n = name, d = date; //null if the string is null
return Documents.Find(x => (n == null || n.Match(x.Name)) && (d == null || d.Match(x.Date)));
}
//Example of calling such function.
//Find item whose name is "example" (case-insensitive) and date starts with "2017-".
var item = x.Find2("example", "2017-*");
Namespace: Au
Assembly: Au.dll
Constructors
Name | Description |
---|---|
wildex(string, bool, bool) |
Properties
Name | Description |
---|---|
IgnoreCase | Is case-insensitive? |
MultiArray | Array of wildex variables, one for each part in multi-part text.
|
Not | Has option |
RegexNet | Gets the Regex object created from regular expression string.
|
RegexPcre | Returns the regexp object created from regular expression string.
|
Text | Returns the text or wildcard string.
|
TextType | Gets the type of text (wildcard, regex, etc). |
Methods
Name | Description |
---|---|
Match(string) | Compares a string with the wildcard expression used to create this wildex. Returns |
ToString() | |
hasWildcardChars(ReadOnlySpan<char>) | Returns |
Operators
Name | Description |
---|---|
implicit operator wildex(string) | Creates new wildex from wildcard expression string.
If the string is |