Match()

From TinyMUX
Jump to navigation Jump to search


match(<list>, <pattern>[,<delimiter>])

This function tests if the pattern matches an element of the list. The pattern can contain the wildcards * and ?.  ? matches to any one character, while * matches to any number of characters including none. So s?x would match to sex or six, but not to socx, but s*x would match to all of them. If no match is found, 0 is returned. If a match is found, it returns the number of the element of the list that matched.

This attempts to match to a list element, not to an entire string. To match an entire string (for example, to match "red blue green" to "*bl*"), use the strmatch() function.

Related Topics

element(), grab()