Tutorial by Topics: matching

selector match partialFunction selector match {list of case alternatives) // This is most common form of the above ParameterDetailsselectorThe expression whose value is being pattern-matched.alternativesa list of case-delimited alternatives.
This topic covers matching string patterns, as well as extracting or replacing them. For details on defining complicated patterns see Regular Expressions. grep("query", "subject", optional_args) grepl("query", "subject", optional_args) gsub(&...
_ // wildcard pattern, matches anything¹ ident // binding pattern, matches anything and binds it to ident¹ ident @ pat // same as above, but allow to further match what is binded ref ident // binding pattern, matches anything and binds it to a reference ident¹ ref mut ident // binding pattern,...
Pattern Matching is a powerful feature of many functional languages as it often allows branching to be handled very succinctly compared to using multiple if/else if/else style statements. However given enough options and "when" guards, Pattern Matching can also become verbose and diffic...
The core.match library implements a pattern match compilation algorithm that uses the notion of "necessity" from lazy pattern matching.
$ shopt -u option # Deactivate Bash's built-in 'option' $ shopt -s option # Activate Bash's built-in 'option' Character Classes Valid character classes for the [] glob are defined by the POSIX standard: alnum alpha ascii blank cntrl digit graph lower print punct space upper word xdig...
string.find(str, pattern [, init [, plain]]) -- Returns start and end index of match in str string.match(str, pattern [, index]) -- Matches a pattern once (starting at index) string.gmatch(str, pattern) -- Returns a function that iterates through all matches in str string.gsub(st...
Pattern matching is the process of branching depending on provided patterns. All pattern matching is done within a switch expression, and individual case expressions represent the patterns. The fundamental rules of pattern matching are: patterns will always be matched from top to bottom; the ...

Page 1 of 1