manpagez: man pages & more
info gawk
Home | html | info | man

File: gawk.info,  Node: Regexp,  Next: Reading Files,  Prev: Invoking Gawk,  Up: Top

3 Regular Expressions
*********************

A "regular expression", or "regexp", is a way of describing a set of
strings.  Because regular expressions are such a fundamental part of
'awk' programming, their format and use deserve a separate major node.

   A regular expression enclosed in slashes ('/') is an 'awk' pattern
that matches every input record whose text belongs to that set.  The
simplest regular expression is a sequence of letters, numbers, or both.
Such a regexp matches any string that contains that sequence.  Thus, the
regexp 'foo' matches any string containing 'foo'.  Thus, the pattern
'/foo/' matches any input record containing the three adjacent
characters 'foo' _anywhere_ in the record.  Other kinds of regexps let
you specify more complicated classes of strings.

* Menu:

* Regexp Usage::                How to Use Regular Expressions.
* Escape Sequences::            How to write nonprinting characters.
* Regexp Operators::            Regular Expression Operators.
* Bracket Expressions::         What can go between '[...]'.
* Leftmost Longest::            How much text matches.
* Computed Regexps::            Using Dynamic Regexps.
* GNU Regexp Operators::        Operators specific to GNU software.
* Case-sensitivity::            How to do case-insensitive matching.
* Regexp Summary::              Regular expressions summary.

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.