ALERT

Stop Ransomware Mid-Flight

Pattern Matching

Definition - What does Pattern Matching mean?

Pattern matching in computer science is the checking and locating of specific sequences of data of some pattern among raw data or a sequence of tokens. Unlike pattern recognition, the match has to be exact in the case of pattern matching. Pattern matching is one of the most fundamental and important paradigms in several programming languages. Many applications make use of pattern matching as a major part of their tasks.

Techopedia explains Pattern Matching

Pattern matching, in its classical form, involves the use of one-dimensional string matching. Patterns are either tree structures or sequences. There are different classes of programming languages and machines which make use of pattern matching. In the case of machines, the major classifications include deterministic finite state automata, deterministic pushdown automata, nondeterministic pushdown automata and Turing machines. Regular programming languages make use of regular expressions for pattern matching. Tree patterns are also used in certain programming languages like Haskell as a tool to process data based on the structure. Compared to regular expressions, tree patterns lack simplicity and efficiency.

There are many applications for pattern matching in computer science. High-level language compilers make use of pattern matching in order to parse source files to determine if they are syntactically correct. In programming languages and applications, pattern matching is used in identifying the matching pattern or substituting the matching pattern with another token sequence.

Share this: