Pattern Matching

What is Pattern Matching?

Pattern matching is an algorithmic task that finds pre-determined patterns among sequences of raw data or processed tokens. In contrast to pattern recognition, this task can only make exact matches from an existing database and won’t discover new patterns. Pattern matching isn’t a deep learning technique, but rather a basic tool used in programming, parsing and error-checking algorithms and data sets.


How does Pattern Matching Work?

Since pattern matching is essentially just filtering and/or replacing data, practically anything can be used for a pattern, including complex strings with wildcards inside and not just discrete variables. The exact process of finding patterns varies, depending on what type of data is being searched for. In most cases, either regular expressions or tree patterns (strings), are checked and then matched with a process-of-elimination approach, like backtracking, rather than a complete, “brute force” search of all the data.