[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to grep/manual/html_node/Basic-vs-Extended.html,v
From: |
Jim Meyering |
Subject: |
Changes to grep/manual/html_node/Basic-vs-Extended.html,v |
Date: |
Sat, 14 Aug 2021 16:46:42 -0400 (EDT) |
CVSROOT: /webcvs/grep
Module name: grep
Changes by: Jim Meyering <meyering> 21/08/14 16:46:41
Index: html_node/Basic-vs-Extended.html
===================================================================
RCS file: /webcvs/grep/grep/manual/html_node/Basic-vs-Extended.html,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- html_node/Basic-vs-Extended.html 28 Sep 2020 03:36:49 -0000 1.31
+++ html_node/Basic-vs-Extended.html 14 Aug 2021 20:46:40 -0000 1.32
@@ -1,8 +1,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
+<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This manual is for grep, a pattern matching engine.
-Copyright (C) 1999-2002, 2005, 2008-2020 Free Software Foundation,
+Copyright (C) 1999-2002, 2005, 2008-2021 Free Software Foundation,
Inc.
Permission is granted to copy, distribute and/or modify this document
@@ -11,85 +14,95 @@
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.5, http://www.gnu.org/software/texinfo/ -->
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<title>Basic vs Extended (GNU Grep 3.5)</title>
+<title>Basic vs Extended (GNU Grep 3.7)</title>
-<meta name="description" content="Basic vs Extended (GNU Grep 3.5)">
-<meta name="keywords" content="Basic vs Extended (GNU Grep 3.5)">
+<meta name="description" content="Basic vs Extended (GNU Grep 3.7)">
+<meta name="keywords" content="Basic vs Extended (GNU Grep 3.7)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
-<link href="index.html#Top" rel="start" title="Top">
-<link href="Index.html#Index" rel="index" title="Index">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+
+<link href="index.html" rel="start" title="Top">
+<link href="Index.html" 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="Character-Encoding.html#Character-Encoding" rel="next"
title="Character Encoding">
-<link
href="Back_002dreferences-and-Subexpressions.html#Back_002dreferences-and-Subexpressions"
rel="prev" title="Back-references and Subexpressions">
+<link href="Regular-Expressions.html" rel="up" title="Regular Expressions">
+<link href="Character-Encoding.html" rel="next" title="Character Encoding">
+<link href="Back_002dreferences-and-Subexpressions.html" rel="prev"
title="Back-references and Subexpressions">
<style type="text/css">
<!--
+a.copiable-anchor {visibility: hidden; text-decoration: none; line-height: 0em}
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.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
+span:hover a.copiable-anchor {visibility: visible}
ul.no-bullet {list-style: none}
-->
</style>
-<link rel="stylesheet" type="text/css" href="/software/gnulib/manual.css">
+<link rel="stylesheet" type="text/css"
href="https://www.gnu.org/software/gnulib/manual.css">
</head>
<body lang="en">
-<a name="Basic-vs-Extended"></a>
+<div class="section" id="Basic-vs-Extended">
<div class="header">
<p>
-Next: <a href="Character-Encoding.html#Character-Encoding" accesskey="n"
rel="next">Character Encoding</a>, 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>
+Next: <a href="Character-Encoding.html" accesskey="n" rel="next">Character
Encoding</a>, Previous: <a href="Back_002dreferences-and-Subexpressions.html"
accesskey="p" rel="prev">Back-references and Subexpressions</a>, Up: <a
href="Regular-Expressions.html" 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" 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>
+<span id="Basic-vs-Extended-Regular-Expressions"></span><h3
class="section">3.6 Basic vs Extended Regular Expressions</h3>
+<span id="index-basic-regular-expressions"></span>
-<p>In basic regular expressions the meta-characters
‘<samp>?</samp>’, ‘<samp>+</samp>’,
+<p>In basic regular expressions the 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>’.
+‘<samp>\|</samp>’, ‘<samp>\(</samp>’, and
‘<samp>\)</samp>’. Also, a backslash is needed
+before an interval expression’s closing ‘<samp>}</samp>’,
and an unmatched
+<code>\)</code> is invalid.
+</p>
+<p>Portable scripts should avoid the following constructs, as
+POSIX says they produce undefined results:
</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>’.
+<ul>
+<li> Extended regular expressions that use back-references.
+</li><li> Basic regular expressions that use ‘<samp>\?</samp>’,
‘<samp>\+</samp>’, or ‘<samp>\|</samp>’.
+</li><li> Empty parenthesized regular expressions like
‘<samp>()</samp>’.
+</li><li> Empty alternatives (as in, e.g, ‘<samp>a|</samp>’).
+</li><li> Repetition operators that immediately follow empty expressions,
+unescaped ‘<samp>$</samp>’, or other repetition operators.
+</li><li> A backslash escaping an ordinary character (e.g.,
‘<samp>\S</samp>’),
+unless it is a back-reference.
+</li><li> An unescaped ‘<samp>[</samp>’ that is not part of a
bracket expression.
+</li><li> In extended regular expressions, an unescaped
‘<samp>{</samp>’ that is not
+part of an interval expression.
+</li></ul>
+
+<span id="index-interval-expressions-1"></span>
+<p>Traditional <code>egrep</code> did not support interval expressions and
+some <code>egrep</code> implementations use ‘<samp>\{</samp>’ and
‘<samp>\}</samp>’ instead, so
+portable scripts should avoid interval expressions 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.
+invalid interval expression.
For example, the command
‘<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>
+</div>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Changes to grep/manual/html_node/Basic-vs-Extended.html,v,
Jim Meyering <=