gawk: Regexp
1
1 3 Regular Expressions
1 *********************
1
1 A "regular expression", or "regexp", is a way of describing a set of
1 strings. Because regular expressions are such a fundamental part of
1 'awk' programming, their format and use deserve a separate major node.
1
1 A regular expression enclosed in slashes ('/') is an 'awk' pattern
1 that matches every input record whose text belongs to that set. The
1 simplest regular expression is a sequence of letters, numbers, or both.
1 Such a regexp matches any string that contains that sequence. Thus, the
1 regexp 'foo' matches any string containing 'foo'. Thus, the pattern
1 '/foo/' matches any input record containing the three adjacent
1 characters 'foo' _anywhere_ in the record. Other kinds of regexps let
1 you specify more complicated classes of strings.
1
Menu