CVSROOT: /web/grep Module name: grep Changes by: Karl Berry <karl> 09/05/24 18:43:01
Index: manual/html_node/Fundamental-Structure.html =================================================================== RCS file: manual/html_node/Fundamental-Structure.html diff -N manual/html_node/Fundamental-Structure.html --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ manual/html_node/Fundamental-Structure.html 24 May 2009 18:42:58 -0000 1.1 @@ -0,0 +1,93 @@ +<html lang="en"> +<head> +<title>Fundamental Structure - GNU Grep 2.5.4</title> +<meta http-equiv="Content-Type" content="text/html"> +<meta name="description" content="GNU Grep 2.5.4"> +<meta name="generator" content="makeinfo 4.13"> +<link title="Top" rel="start" href="index.html#Top"> +<link rel="up" href="Regular-Expressions.html#Regular-Expressions" title="Regular Expressions"> +<link rel="next" href="Character-Classes-and-Bracket-Expressions.html#Character-Classes-and-Bracket-Expressions" title="Character Classes and Bracket Expressions"> +<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> +<!-- +This manual is for `grep', a pattern matching engine. + +Copyright (C) 1999, 2000, 2001, 2002, 2005, 2008, 2009 Free +Software Foundation, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU Free Documentation License, + Version 1.3 or any later version published by the Free Software + Foundation; with no Invariant Sections, with no Front-Cover Texts, + and with no Back-Cover Texts. A copy of the license is included + in the section entitled ``GNU Free Documentation License''. + --> +<meta http-equiv="Content-Style-Type" content="text/css"> +<style type="text/css"><!-- + pre.display { font-family:inherit } + pre.format { font-family:inherit } + pre.smalldisplay { font-family:inherit; font-size:smaller } + pre.smallformat { font-family:inherit; font-size:smaller } + pre.smallexample { font-size:smaller } + pre.smalllisp { font-size:smaller } + span.sc { font-variant:small-caps } + span.roman { font-family:serif; font-weight:normal; } + span.sansserif { font-family:sans-serif; font-weight:normal; } +--></style> +</head> +<body> +<div class="node"> +<a name="Fundamental-Structure"></a> +<p> +Next: <a rel="next" accesskey="n" href="Character-Classes-and-Bracket-Expressions.html#Character-Classes-and-Bracket-Expressions">Character Classes and Bracket Expressions</a>, +Up: <a rel="up" accesskey="u" href="Regular-Expressions.html#Regular-Expressions">Regular Expressions</a> +<hr> +</div> + +<h3 class="section">3.1 Fundamental Structure</h3> + +<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 meta-character +with special meaning may be quoted by preceding it with a backslash. + + <p>A regular expression may be followed by one of several +repetition operators: + + <dl> +<dt>‘<samp><span class="samp">.</span></samp>’<dd><a name="index-g_t_002e-179"></a><a name="index-dot-180"></a><a name="index-period-181"></a>The period ‘<samp><span class="samp">.</span></samp>’ matches any single character. + + <br><dt>‘<samp><span class="samp">?</span></samp>’<dd><a name="index-g_t_003f-182"></a><a name="index-question-mark-183"></a><a name="index-match-expression-at-most-once-184"></a>The preceding item is optional and will be matched at most once. + + <br><dt>‘<samp><span class="samp">*</span></samp>’<dd><a name="index-g_t_002a-185"></a><a name="index-asterisk-186"></a><a name="index-match-expression-zero-or-more-times-187"></a>The preceding item will be matched zero or more times. + + <br><dt>‘<samp><span class="samp">+</span></samp>’<dd><a name="index-g_t_002b-188"></a><a name="index-plus-sign-189"></a><a name="index-match-expression-one-or-more-times-190"></a>The preceding item will be matched one or more times. + + <br><dt>‘<samp><span class="samp">{</span><var>n</var><span class="samp">}</span></samp>’<dd><a name="index-g_t_0040_007b_0040var_007bn_007d_0040_007d-191"></a><a name="index-braces_002c-one-argument-192"></a><a name="index-match-expression-_0040var_007bn_007d-times-193"></a>The preceding item is matched exactly <var>n</var> times. + + <br><dt>‘<samp><span class="samp">{</span><var>n</var><span class="samp">,}</span></samp>’<dd><a name="index-g_t_0040_007b_0040var_007bn_007d_002c_0040_007d-194"></a><a name="index-braces_002c-second-argument-omitted-195"></a><a name="index-match-expression-_0040var_007bn_007d-or-more-times-196"></a>The preceding item is matched <var>n</var> or more times. + + <br><dt>‘<samp><span class="samp">{,</span><var>m</var><span class="samp">}</span></samp>’<dd><a name="index-g_t_0040_007b_002c_0040var_007bm_007d_0040_007d-197"></a><a name="index-braces_002c-first-argument-omitted-198"></a><a name="index-match-expression-at-most-_0040var_007bm_007d-times-199"></a>The preceding item is matched at most <var>m</var> times. + + <br><dt>‘<samp><span class="samp">{</span><var>n</var><span class="samp">,</span><var>m</var><span class="samp">}</span></samp>’<dd><a name="index-g_t_0040_007b_0040var_007bn_007d_002c_0040var_007bm_007d_0040_007d-200"></a><a name="index-braces_002c-two-arguments-201"></a><a name="index-match-expression-from-_0040var_007bn_007d-to-_0040var_007bm_007d-times-202"></a>The preceding item is matched at least <var>n</var> times, but not more than +<var>m</var> times. + + </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 expressions. + + <p>Two regular expressions may be joined by the infix operator ‘<samp><span class="samp">|</span></samp>’; +the resulting regular expression +matches any string matching either alternalte expression. + + <p>Repetition takes precedence over concatenation, +which in turn takes precedence over alternation. +A whole expression may be enclosed in parentheses +to override these precedence rules and form a subexpression. + + </body></html> +
