Match(
string:string,
string:pattern,
[string:flags]
)
→ bool
| c | consider case when performing the operation |
| x | simple matching against multiple file extensions |
| d | support DOS wildcard characters only |
| r | use regular expression |
| h | easy handling for file paths (\ and / are considered the same) |
| a | "any word" mode |
| i | ignore diacritics |
| f | support filetype groups |
| p | partial matching |
| n | force partial match on for regular expression (see below) |
Returns True if the input string matches the specified wildcard pattern.
By default this uses standard pattern matching - specify the r flag to use regular expressions instead.
For regular expression, partial match is automatically disabled if the pattern begins or ends with a .* sequence. To prevent this, specify the n flag. This forces partial match (as the "normal" regex behaviour), but you can perform a non-partial match by adding ^ to the start and $ to the end of the pattern.
Example:
if (Match(name, "*.txt")) { ... } // does file have a .txt extension?