Pattern matching: Difference between revisions

Content deleted Content added
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
No edit summary
Line 2:
{{for|the use of variable matching criteria in defining abstract patterns to match|regular expression}}
{{Refimprove|date=February 2011}}
In [[computer science]], '''pattern matching''' is the actart of checking a given '''sequence''' of tokens for the presence of the constituents of some [[pattern]]. In contrast to [[pattern recognition]], the match usually has to be exact: "either it will or will not be a match." The patterns generally have the form of either [[string (computer science)|sequences]] or [[tree structure]]s. Uses of pattern matching include outputting the locations (if any) of a pattern within a token sequence, to output some component of the matched pattern, and to substitute the matching pattern with some other token sequence (i.e., [[Regular expression|search and replace]]).
 
Sequence patterns (e.g., a text string) are often described using [[regular expression]]s and matched using techniques such as [[backtracking]].