CVSROOT: /webcvs/grep Module name: grep Changes by: Jim Meyering <meyering> 16/02/05 00:44:53
Index: html_node/Basic-vs-Extended.html =================================================================== RCS file: /webcvs/grep/grep/manual/html_node/Basic-vs-Extended.html,v retrieving revision 1.21 retrieving revision 1.22 diff -u -b -r1.21 -r1.22 --- html_node/Basic-vs-Extended.html 2 Nov 2015 02:54:31 -0000 1.21 +++ html_node/Basic-vs-Extended.html 5 Feb 2016 00:44:50 -0000 1.22 @@ -1,70 +1,99 @@ -<html lang="en"> +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<!-- This manual is for grep, a pattern matching engine. + +Copyright (C) 1999-2002, 2005, 2008-2016 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". --> +<!-- Created by GNU Texinfo 6.0, http://www.gnu.org/software/texinfo/ --> <head> -<title>Basic vs Extended - GNU Grep 2.22</title> +<title>GNU Grep 2.23: Basic vs Extended</title> + +<meta name="description" content="GNU Grep 2.23: Basic vs Extended"> +<meta name="keywords" content="GNU Grep 2.23: Basic vs Extended"> +<meta name="resource-type" content="document"> +<meta name="distribution" content="global"> +<meta name="Generator" content="makeinfo"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -<meta name="description" content="GNU Grep 2.22"> -<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="prev" href="Back_002dreferences-and-Subexpressions.html#Back_002dreferences-and-Subexpressions" title="Back-references and Subexpressions"> -<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> +<link href="index.html#Top" rel="start" title="Top"> +<link href="Index.html#Index" rel="index" title="Index"> +<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> +<link href="Regular-Expressions.html#Regular-Expressions" rel="up" title="Regular Expressions"> +<link href="Usage.html#Usage" rel="next" title="Usage"> +<link href="Back_002dreferences-and-Subexpressions.html#Back_002dreferences-and-Subexpressions" rel="prev" title="Back-references and Subexpressions"> +<style type="text/css"> <!-- -This manual is for `grep', a pattern matching engine. +a.summary-letter {text-decoration: none} +blockquote.indentedblock {margin-right: 0em} +blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} +blockquote.smallquotation {font-size: smaller} +div.display {margin-left: 3.2em} +div.example {margin-left: 3.2em} +div.lisp {margin-left: 3.2em} +div.smalldisplay {margin-left: 3.2em} +div.smallexample {margin-left: 3.2em} +div.smalllisp {margin-left: 3.2em} +kbd {font-style: oblique} +pre.display {font-family: inherit} +pre.format {font-family: inherit} +pre.menu-comment {font-family: serif} +pre.menu-preformatted {font-family: serif} +pre.smalldisplay {font-family: inherit; font-size: smaller} +pre.smallexample {font-size: smaller} +pre.smallformat {font-family: inherit; font-size: smaller} +pre.smalllisp {font-size: smaller} +span.nocodebreak {white-space: nowrap} +span.nolinebreak {white-space: nowrap} +span.roman {font-family: serif; font-weight: normal} +span.sansserif {font-family: sans-serif; font-weight: normal} +ul.no-bullet {list-style: none} +--> +</style> +<link rel="stylesheet" type="text/css" href="/software/gnulib/manual.css"> -Copyright (C) 1999-2002, 2005, 2008-2015 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> -<link rel="stylesheet" type="text/css" href="/software/gnulib/manual.css"> </head> -<body> -<div class="node"> + +<body lang="en"> <a name="Basic-vs-Extended"></a> +<div class="header"> <p> -Previous: <a rel="previous" accesskey="p" href="Back_002dreferences-and-Subexpressions.html#Back_002dreferences-and-Subexpressions">Back-references and Subexpressions</a>, -Up: <a rel="up" accesskey="u" href="Regular-Expressions.html#Regular-Expressions">Regular Expressions</a> -<hr> +Previous: <a href="Back_002dreferences-and-Subexpressions.html#Back_002dreferences-and-Subexpressions" accesskey="p" rel="prev">Back-references and Subexpressions</a>, Up: <a href="Regular-Expressions.html#Regular-Expressions" accesskey="u" rel="up">Regular Expressions</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p> </div> - +<hr> +<a name="Basic-vs-Extended-Regular-Expressions"></a> <h3 class="section">3.6 Basic vs Extended Regular Expressions</h3> +<a name="index-basic-regular-expressions"></a> -<p><a name="index-basic-regular-expressions-253"></a> -In basic regular expressions the meta-characters ‘<samp><span class="samp">?</span></samp>’, ‘<samp><span class="samp">+</span></samp>’, -‘<samp><span class="samp">{</span></samp>’, ‘<samp><span class="samp">|</span></samp>’, ‘<samp><span class="samp">(</span></samp>’, and ‘<samp><span class="samp">)</span></samp>’ lose their special meaning; -instead use the backslashed versions ‘<samp><span class="samp">\?</span></samp>’, ‘<samp><span class="samp">\+</span></samp>’, ‘<samp><span class="samp">\{</span></samp>’, -‘<samp><span class="samp">\|</span></samp>’, ‘<samp><span class="samp">\(</span></samp>’, and ‘<samp><span class="samp">\)</span></samp>’. - - <p><a name="index-interval-specifications-254"></a>Traditional <samp><span class="command">egrep</span></samp> did not support the ‘<samp><span class="samp">{</span></samp>’ meta-character, -and some <samp><span class="command">egrep</span></samp> implementations support ‘<samp><span class="samp">\{</span></samp>’ instead, so -portable scripts should avoid ‘<samp><span class="samp">{</span></samp>’ in ‘<samp><span class="samp">grep -E</span></samp>’ patterns and -should use ‘<samp><span class="samp">[{]</span></samp>’ to match a literal ‘<samp><span class="samp">{</span></samp>’. - - <p>GNU <samp><span class="command">grep -E</span></samp> attempts to support traditional usage by -assuming that ‘<samp><span class="samp">{</span></samp>’ is not special if it would be the start of an +<p>In basic regular expressions the meta-characters ‘<samp>?</samp>’, ‘<samp>+</samp>’, +‘<samp>{</samp>’, ‘<samp>|</samp>’, ‘<samp>(</samp>’, and ‘<samp>)</samp>’ lose their special meaning; +instead use the backslashed versions ‘<samp>\?</samp>’, ‘<samp>\+</samp>’, ‘<samp>\{</samp>’, +‘<samp>\|</samp>’, ‘<samp>\(</samp>’, and ‘<samp>\)</samp>’. +</p> +<a name="index-interval-specifications"></a> +<p>Traditional <code>egrep</code> did not support the ‘<samp>{</samp>’ meta-character, +and some <code>egrep</code> implementations support ‘<samp>\{</samp>’ instead, so +portable scripts should avoid ‘<samp>{</samp>’ in ‘<samp>grep -E</samp>’ patterns and +should use ‘<samp>[{]</samp>’ to match a literal ‘<samp>{</samp>’. +</p> +<p>GNU <code>grep -E</code> attempts to support traditional usage by +assuming that ‘<samp>{</samp>’ is not special if it would be the start of an invalid interval specification. For example, the command -‘<samp><span class="samp">grep -E '{1'</span></samp>’ searches for the two-character string ‘<samp><span class="samp">{1</span></samp>’ +‘<samp>grep -E '{1'</samp>’ searches for the two-character string ‘<samp>{1</samp>’ instead of reporting a syntax error in the regular expression. POSIX allows this behavior as an extension, but portable scripts should avoid it. +</p> + + - </body></html> +</body> +</html>
