In this context, a pattern is a way of expressing a set of strings, and pattern matching is the act of determining whether a particular string is in the set described by the pattern. For example, some matches for the set of strings containing digits would be "7", "123" and "November 4th". But not "November" or "fourth".
The GNU C library supports a number of pattern matching concepts, from very basic wildcard matching, through to extended regular expression matching. In this section we will describe each, and provide annotated examples.
Pattern matching is a concept that is central to the operation of modern
operating systems. The GNU system provides several tools that use
pattern matching: grep
, sed
and even the shell
itself. The GNU C library provides the APIs for employing
pattern matching techniques in your own programs.