Pattern matching is a really powerful feature of most functional languages. It is embedded inside the language at various levels. In Scala, for example, you can use it as a beefed up
switch statement, and in Haskell it is an integral part of function definition.
Pattern matching is the process of checking a series of tokens against a pattern. It is different from pattern recognition as the match needs to be exact. The process does not only match as a switch statement does, it also assigns the value as with the
list construct in PHP, a process called destructuring assignment.
It is not to be confused with regular expressions. Regular expressions can only operate on the content of strings, where as pattern matching can also operate ...