CVSROOT: /web/grep Module name: grep Changes by: Karl Berry <karl> 09/05/24 18:43:01
Index: manual/html_node/Basic-vs-Extended.html =================================================================== RCS file: manual/html_node/Basic-vs-Extended.html diff -N manual/html_node/Basic-vs-Extended.html --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ manual/html_node/Basic-vs-Extended.html 24 May 2009 18:42:58 -0000 1.1 @@ -0,0 +1,69 @@ +<html lang="en"> +<head> +<title>Basic vs Extended - 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="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"> +<!-- +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="Basic-vs-Extended"></a> +<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> +</div> + +<h3 class="section">3.6 Basic vs Extended Regular Expressions</h3> + +<p><a name="index-basic-regular-expressions-239"></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-240"></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><span class="sc">gnu</span> <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 +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>’ +instead of reporting a syntax error in the regular expression. +<span class="sc">posix.2</span> allows this behavior as an extension, but portable scripts +should avoid it. + + </body></html> +
