CVSROOT: /web/grep Module name: grep Changes by: Karl Berry <karl> 09/05/24 18:43:01
Index: doc/grep_7.html =================================================================== RCS file: doc/grep_7.html diff -N doc/grep_7.html --- doc/grep_7.html 23 Jan 2002 10:33:52 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,151 +0,0 @@ -<HTML> -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> -<!-- Created on January, 23 2002 by texi2html 1.64 --> -<!-- -Written by: Lionel Cons <[email protected]> (original author) - Karl Berry <[email protected]> - Olaf Bachmann <[email protected]> - and many others. -Maintained by: Olaf Bachmann <[email protected]> -Send bugs and suggestions to <[email protected]> - ---> -<HEAD> -<TITLE>grep, print lines matching a pattern: Regular Expressions</TITLE> - -<META NAME="description" CONTENT="grep, print lines matching a pattern: Regular Expressions"> -<META NAME="keywords" CONTENT="grep, print lines matching a pattern: Regular Expressions"> -<META NAME="resource-type" CONTENT="document"> -<META NAME="distribution" CONTENT="global"> -<META NAME="Generator" CONTENT="texi2html 1.64"> - -</HEAD> - -<BODY LANG="" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000"> - -<A NAME="SEC7"></A> -<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> -<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_6.html#SEC6"> < </A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_8.html#SEC8"> > </A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_13.html#SEC13"> << </A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep.html#SEC_Top"> Up </A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_13.html#SEC13"> >> </A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep.html#SEC_Top">Top</A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_toc.html#SEC_Contents">Contents</A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_21.html#SEC21">Index</A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_abt.html#SEC_About"> ? </A>]</TD> -</TR></TABLE> -<HR SIZE=1> -<H1> 5. Regular Expressions </H1> -<!--docid::SEC7::--> -<P> - -A <EM>regular expression</EM> is a pattern that describes a set of strings. -Regular expressions are constructed analogously to arithmetic expressions, -by using various operators to combine smaller expressions. -<CODE>grep</CODE> understands two different versions of regular expression -syntax: "basic"(BRE) and "extended"(ERE). In GNU <CODE>grep</CODE>, -there is no difference in available functionality using either syntax. -In other implementations, basic regular expressions are less powerful. -The following description applies to extended regular expressions; -differences for basic regular expressions are summarized afterwards. -</P><P> - -The fundamental building blocks are the regular expressions that match -a single character. Most characters, including all letters and digits, -are regular expressions that match themselves. Any metacharacter -with special meaning may be quoted by preceding it with a backslash. -</P><P> - -A regular expression may be followed by one of several -repetition operators: -</P><P> - -<DL COMPACT> - -<DT><SAMP>`.'</SAMP> -<DD><A NAME="IDX157"></A> -<A NAME="IDX158"></A> -<A NAME="IDX159"></A> -The period <SAMP>`.'</SAMP> matches any single character. -<P> - -<DT><SAMP>`?'</SAMP> -<DD><A NAME="IDX160"></A> -<A NAME="IDX161"></A> -<A NAME="IDX162"></A> -The preceding item is optional and will be matched at most once. -<P> - -<DT><SAMP>`*'</SAMP> -<DD><A NAME="IDX163"></A> -<A NAME="IDX164"></A> -<A NAME="IDX165"></A> -The preceding item will be matched zero or more times. -<P> - -<DT><SAMP>`+'</SAMP> -<DD><A NAME="IDX166"></A> -<A NAME="IDX167"></A> -The preceding item will be matched one or more times. -<P> - -<DT><SAMP>`{<VAR>n</VAR>}'</SAMP> -<DD><A NAME="IDX168"></A> -<A NAME="IDX169"></A> -<A NAME="IDX170"></A> -The preceding item is matched exactly <VAR>n</VAR> times. -<P> - -<DT><SAMP>`{<VAR>n</VAR>,}'</SAMP> -<DD><A NAME="IDX171"></A> -<A NAME="IDX172"></A> -<A NAME="IDX173"></A> -The preceding item is matched n or more times. -<P> - -<DT><SAMP>`{<VAR>n</VAR>,<VAR>m</VAR>}'</SAMP> -<DD><A NAME="IDX174"></A> -<A NAME="IDX175"></A> -The preceding item is matched at least <VAR>n</VAR> times, but not more than -<VAR>m</VAR> times. -<P> - -</DL> -<P> - -Two regular expressions may be concatenated; the resulting regular -expression matches any string formed by concatenating two substrings -that respectively match the concatenated subexpressions. -</P><P> - -Two regular expressions may be joined by the infix operator <SAMP>`|'</SAMP>; the -resulting regular expression matches any string matching either subexpression. -</P><P> - -Repetition takes precedence over concatenation, which in turn -takes precedence over alternation. A whole subexpression may be -enclosed in parentheses to override these precedence rules. -</P><P> - -<HR SIZE=1> -<TABLE CELLPADDING=1 CELLSPACING=1 BORDER=0> -<TR><TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_6.html#SEC6"> < </A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_8.html#SEC8"> > </A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_13.html#SEC13"> << </A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep.html#SEC_Top"> Up </A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_13.html#SEC13"> >> </A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT"> <TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep.html#SEC_Top">Top</A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_toc.html#SEC_Contents">Contents</A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_21.html#SEC21">Index</A>]</TD> -<TD VALIGN="MIDDLE" ALIGN="LEFT">[<A HREF="grep_abt.html#SEC_About"> ? </A>]</TD> -</TR></TABLE> -<BR> -<FONT SIZE="-1"> -This document was generated -by <I>root</I> on <I>January, 23 2002</I> -using <A HREF="http://www.mathematik.uni-kl.de/~obachman/Texi2html -"><I>texi2html</I></A> - -</BODY> -</HTML>
