Match(
     string:string,
     string:pattern,
     [string:flags]
)
bool

Arguments

string

String to compare.

pattern

Pattern to compare against.

flags

Optional. Optional flags are:

cconsider case when performing the operation
xsimple matching against multiple file extensions
dsupport DOS wildcard characters only
ruse regular expression
heasy handling for file paths (\\ and / are considered the same)
a"any word" mode
iignore diacritics
fsupport filetype groups
ppartial matching

Return value

True if string matches the pattern.

Description

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.

Example:

if (Match(name, "*.txt")) { ... } // does file have a .txt extension?