[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Changes to grep/manual/html_node/Character-Classes-and-Bracket-Expressio
From: |
Jim Meyering |
Subject: |
Changes to grep/manual/html_node/Character-Classes-and-Bracket-Expressions.html, v |
Date: |
Wed, 22 Mar 2023 22:55:25 -0400 (EDT) |
CVSROOT: /webcvs/grep
Module name: grep
Changes by: Jim Meyering <meyering> 23/03/22 22:55:22
Index: html_node/Character-Classes-and-Bracket-Expressions.html
===================================================================
RCS file:
/webcvs/grep/grep/manual/html_node/Character-Classes-and-Bracket-Expressions.html,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- html_node/Character-Classes-and-Bracket-Expressions.html 3 Sep 2022
19:33:14 -0000 1.33
+++ html_node/Character-Classes-and-Bracket-Expressions.html 23 Mar 2023
02:55:21 -0000 1.34
@@ -1,11 +1,11 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
+<!DOCTYPE html>
<html>
-<!-- Created by GNU Texinfo 6.8, https://www.gnu.org/software/texinfo/ -->
+<!-- Created by GNU Texinfo 7.0dev, 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-2022 Free Software Foundation,
+Copyright © 1999-2002, 2005, 2008-2023 Free Software Foundation,
Inc.
Permission is granted to copy, distribute and/or modify this document
@@ -14,10 +14,10 @@
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". -->
-<title>Character Classes and Bracket Expressions (GNU Grep 3.8)</title>
+<title>Character Classes and Bracket Expressions (GNU Grep 3.10)</title>
-<meta name="description" content="Character Classes and Bracket Expressions
(GNU Grep 3.8)">
-<meta name="keywords" content="Character Classes and Bracket Expressions (GNU
Grep 3.8)">
+<meta name="description" content="Character Classes and Bracket Expressions
(GNU Grep 3.10)">
+<meta name="keywords" content="Character Classes and Bracket Expressions (GNU
Grep 3.10)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
@@ -31,21 +31,9 @@
<link href="Fundamental-Structure.html" rel="prev" title="Fundamental
Structure">
<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}
-div.display {margin-left: 3.2em}
-div.example {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}
-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}
+a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
+span.r {font-family: initial; font-weight: normal; font-style: normal}
+span:hover a.copiable-link {visibility: visible}
-->
</style>
<link rel="stylesheet" type="text/css"
href="https://www.gnu.org/software/gnulib/manual.css">
@@ -54,74 +42,78 @@
</head>
<body lang="en">
-<div class="section" id="Character-Classes-and-Bracket-Expressions">
-<div class="header">
+<div class="section-level-extent"
id="Character-Classes-and-Bracket-Expressions">
+<div class="nav-panel">
<p>
Next: <a href="Special-Backslash-Expressions.html" accesskey="n"
rel="next">Special Backslash Expressions</a>, Previous: <a
href="Fundamental-Structure.html" accesskey="p" rel="prev">Fundamental
Structure</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>
-<span id="Character-Classes-and-Bracket-Expressions-1"></span><h3
class="section">3.2 Character Classes and Bracket Expressions</h3>
+<h3 class="section" id="Character-Classes-and-Bracket-Expressions-1"><span>3.2
Character Classes and Bracket Expressions<a class="copiable-link"
href="#Character-Classes-and-Bracket-Expressions-1"> ¶</a></span></h3>
-<span id="index-bracket-expression"></span>
-<span id="index-character-class"></span>
-<p>A <em>bracket expression</em> is a list of characters enclosed by
‘<samp>[</samp>’ and
-‘<samp>]</samp>’.
+<a class="index-entry-id" id="index-bracket-expression"></a>
+<a class="index-entry-id" id="index-character-class"></a>
+<p>A <em class="dfn">bracket expression</em> is a list of characters enclosed
by ‘<samp class="samp">[</samp>’ and
+‘<samp class="samp">]</samp>’.
It matches any single character in that list.
-If the first character of the list is the caret ‘<samp>^</samp>’,
-then it matches any character <strong>not</strong> in the list,
+If the first character of the list is the caret ‘<samp
class="samp">^</samp>’,
+then it matches any character <strong class="strong">not</strong> in the list,
and it is unspecified whether it matches an encoding error.
For example, the regular expression
-‘<samp>[0123456789]</samp>’ matches any single digit,
-whereas ‘<samp>[^()]</samp>’ matches any single character that is
not
+‘<samp class="samp">[0123456789]</samp>’ matches any single digit,
+whereas ‘<samp class="samp">[^()]</samp>’ matches any single
character that is not
an opening or closing parenthesis, and might or might not match an
encoding error.
</p>
-<span id="index-range-expression"></span>
-<p>Within a bracket expression, a <em>range expression</em> consists of two
+<a class="index-entry-id" id="index-range-expression"></a>
+<p>Within a bracket expression, a <em class="dfn">range expression</em>
consists of two
characters separated by a hyphen.
It matches any single character that
sorts between the two characters, inclusive.
In the default C locale, the sorting sequence is the native character
-order; for example, ‘<samp>[a-d]</samp>’ is equivalent to
‘<samp>[abcd]</samp>’.
+order; for example, ‘<samp class="samp">[a-d]</samp>’ is
equivalent to ‘<samp class="samp">[abcd]</samp>’.
In other locales, the sorting sequence is not specified, and
-‘<samp>[a-d]</samp>’ might be equivalent to
‘<samp>[abcd]</samp>’ or to
-‘<samp>[aBbCcDd]</samp>’, or it might fail to match any character,
or the set of
+‘<samp class="samp">[a-d]</samp>’ might be equivalent to
‘<samp class="samp">[abcd]</samp>’ or to
+‘<samp class="samp">[aBbCcDd]</samp>’, or it might fail to match
any character, or the set of
characters that it matches might be erratic, or it might be invalid.
To obtain the traditional interpretation
-of bracket expressions, you can use the ‘<samp>C</samp>’ locale by
setting the
-<code>LC_ALL</code> environment variable to the value
‘<samp>C</samp>’.
+of bracket expressions, you can use the ‘<samp
class="samp">C</samp>’ locale by setting the
+<code class="env">LC_ALL</code> environment variable to the value ‘<samp
class="samp">C</samp>’.
</p>
<p>Finally, certain named classes of characters are predefined within
bracket expressions, as follows.
-Their interpretation depends on the <code>LC_CTYPE</code> locale;
-for example, ‘<samp>[[:alnum:]]</samp>’ means the character class
of numbers and letters
+Their interpretation depends on the <code class="env">LC_CTYPE</code> locale;
+for example, ‘<samp class="samp">[[:alnum:]]</samp>’ means the
character class of numbers and letters
in the current locale.
</p>
-<span id="index-classes-of-characters"></span>
-<span id="index-character-classes"></span>
-<dl compact="compact">
-<dt
id='index-alnum-character-class'><span>‘<samp>[:alnum:]</samp>’<a
href='#index-alnum-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-alphanumeric-characters"></span>
+<a class="index-entry-id" id="index-classes-of-characters"></a>
+<a class="index-entry-id" id="index-character-classes"></a>
+<dl class="table">
+<dt>‘<samp class="samp">[:alnum:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-alnum-character-class"></a>
+<a class="index-entry-id" id="index-alphanumeric-characters"></a>
<p>Alphanumeric characters:
-‘<samp>[:alpha:]</samp>’ and ‘<samp>[:digit:]</samp>’;
in the ‘<samp>C</samp>’ locale and ASCII
-character encoding, this is the same as ‘<samp>[0-9A-Za-z]</samp>’.
+‘<samp class="samp">[:alpha:]</samp>’ and ‘<samp
class="samp">[:digit:]</samp>’; in the ‘<samp
class="samp">C</samp>’ locale and ASCII
+character encoding, this is the same as ‘<samp
class="samp">[0-9A-Za-z]</samp>’.
</p>
</dd>
-<dt
id='index-alpha-character-class'><span>‘<samp>[:alpha:]</samp>’<a
href='#index-alpha-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-alphabetic-characters"></span>
+<dt>‘<samp class="samp">[:alpha:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-alpha-character-class"></a>
+<a class="index-entry-id" id="index-alphabetic-characters"></a>
<p>Alphabetic characters:
-‘<samp>[:lower:]</samp>’ and ‘<samp>[:upper:]</samp>’;
in the ‘<samp>C</samp>’ locale and ASCII
-character encoding, this is the same as ‘<samp>[A-Za-z]</samp>’.
+‘<samp class="samp">[:lower:]</samp>’ and ‘<samp
class="samp">[:upper:]</samp>’; in the ‘<samp
class="samp">C</samp>’ locale and ASCII
+character encoding, this is the same as ‘<samp
class="samp">[A-Za-z]</samp>’.
</p>
</dd>
-<dt
id='index-blank-character-class'><span>‘<samp>[:blank:]</samp>’<a
href='#index-blank-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-blank-characters"></span>
+<dt>‘<samp class="samp">[:blank:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-blank-character-class"></a>
+<a class="index-entry-id" id="index-blank-characters"></a>
<p>Blank characters:
space and tab.
</p>
</dd>
-<dt
id='index-cntrl-character-class'><span>‘<samp>[:cntrl:]</samp>’<a
href='#index-cntrl-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-control-characters"></span>
+<dt>‘<samp class="samp">[:cntrl:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-cntrl-character-class"></a>
+<a class="index-entry-id" id="index-control-characters"></a>
<p>Control characters.
In ASCII, these characters have octal codes 000
through 037, and 177 (DEL).
@@ -129,58 +121,66 @@
the equivalent characters, if any.
</p>
</dd>
-<dt
id='index-digit-character-class'><span>‘<samp>[:digit:]</samp>’<a
href='#index-digit-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-digit-characters"></span>
-<span id="index-numeric-characters"></span>
-<p>Digits: <code>0 1 2 3 4 5 6 7 8 9</code>.
+<dt>‘<samp class="samp">[:digit:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-digit-character-class"></a>
+<a class="index-entry-id" id="index-digit-characters"></a>
+<a class="index-entry-id" id="index-numeric-characters"></a>
+<p>Digits: <code class="code">0 1 2 3 4 5 6 7 8 9</code>.
</p>
</dd>
-<dt
id='index-graph-character-class'><span>‘<samp>[:graph:]</samp>’<a
href='#index-graph-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-graphic-characters"></span>
+<dt>‘<samp class="samp">[:graph:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-graph-character-class"></a>
+<a class="index-entry-id" id="index-graphic-characters"></a>
<p>Graphical characters:
-‘<samp>[:alnum:]</samp>’ and ‘<samp>[:punct:]</samp>’.
+‘<samp class="samp">[:alnum:]</samp>’ and ‘<samp
class="samp">[:punct:]</samp>’.
</p>
</dd>
-<dt
id='index-lower-character-class'><span>‘<samp>[:lower:]</samp>’<a
href='#index-lower-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-lower_002dcase-letters"></span>
-<p>Lower-case letters; in the ‘<samp>C</samp>’ locale and ASCII
character
+<dt>‘<samp class="samp">[:lower:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-lower-character-class"></a>
+<a class="index-entry-id" id="index-lower_002dcase-letters"></a>
+<p>Lower-case letters; in the ‘<samp class="samp">C</samp>’ locale
and ASCII character
encoding, this is
-<code>a b c d e f g h i j k l m n o p q r s t u v w x y z</code>.
+<code class="code">a b c d e f g h i j k l m n o p q r s t u v w x y z</code>.
</p>
</dd>
-<dt
id='index-print-character-class'><span>‘<samp>[:print:]</samp>’<a
href='#index-print-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-printable-characters"></span>
+<dt>‘<samp class="samp">[:print:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-print-character-class"></a>
+<a class="index-entry-id" id="index-printable-characters"></a>
<p>Printable characters:
-‘<samp>[:alnum:]</samp>’, ‘<samp>[:punct:]</samp>’,
and space.
+‘<samp class="samp">[:alnum:]</samp>’, ‘<samp
class="samp">[:punct:]</samp>’, and space.
</p>
</dd>
-<dt
id='index-punct-character-class'><span>‘<samp>[:punct:]</samp>’<a
href='#index-punct-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-punctuation-characters"></span>
-<p>Punctuation characters; in the ‘<samp>C</samp>’ locale and
ASCII character
+<dt>‘<samp class="samp">[:punct:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-punct-character-class"></a>
+<a class="index-entry-id" id="index-punctuation-characters"></a>
+<p>Punctuation characters; in the ‘<samp class="samp">C</samp>’
locale and ASCII character
encoding, this is
-<code>! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` {
| } ~</code>.
+<code class="code">! " # $ % & ' ( ) * + , - . / : ; < = > ? @
[ \ ] ^ _ ` { | } ~</code>.
</p>
</dd>
-<dt
id='index-space-character-class'><span>‘<samp>[:space:]</samp>’<a
href='#index-space-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-space-characters"></span>
-<span id="index-whitespace-characters"></span>
-<p>Space characters: in the ‘<samp>C</samp>’ locale, this is
+<dt>‘<samp class="samp">[:space:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-space-character-class"></a>
+<a class="index-entry-id" id="index-space-characters"></a>
+<a class="index-entry-id" id="index-whitespace-characters"></a>
+<p>Space characters: in the ‘<samp class="samp">C</samp>’ locale,
this is
tab, newline, vertical tab, form feed, carriage return, and space.
-See <a href="Usage.html">Usage</a>, for more discussion of matching newlines.
+See <a class="xref" href="Usage.html">Usage</a>, for more discussion of
matching newlines.
</p>
</dd>
-<dt
id='index-upper-character-class'><span>‘<samp>[:upper:]</samp>’<a
href='#index-upper-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-upper_002dcase-letters"></span>
-<p>Upper-case letters: in the ‘<samp>C</samp>’ locale and ASCII
character
+<dt>‘<samp class="samp">[:upper:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-upper-character-class"></a>
+<a class="index-entry-id" id="index-upper_002dcase-letters"></a>
+<p>Upper-case letters: in the ‘<samp class="samp">C</samp>’ locale
and ASCII character
encoding, this is
-<code>A B C D E F G H I J K L M N O P Q R S T U V W X Y Z</code>.
+<code class="code">A B C D E F G H I J K L M N O P Q R S T U V W X Y Z</code>.
</p>
</dd>
-<dt
id='index-xdigit-character-class'><span>‘<samp>[:xdigit:]</samp>’<a
href='#index-xdigit-character-class' class='copiable-anchor'>
¶</a></span></dt>
-<dd><span id="index-xdigit-class"></span>
-<span id="index-hexadecimal-digits"></span>
+<dt>‘<samp class="samp">[:xdigit:]</samp>’</dt>
+<dd><a class="index-entry-id" id="index-xdigit-character-class"></a>
+<a class="index-entry-id" id="index-xdigit-class"></a>
+<a class="index-entry-id" id="index-hexadecimal-digits"></a>
<p>Hexadecimal digits:
-<code>0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f</code>.
+<code class="code">0 1 2 3 4 5 6 7 8 9 A B C D E F a b c d e f</code>.
</p>
</dd>
</dl>
@@ -188,53 +188,53 @@
part of the symbolic names, and must be included in addition to
the brackets delimiting the bracket expression.
</p>
-<p>If you mistakenly omit the outer brackets, and search for say,
‘<samp>[:upper:]</samp>’,
-GNU <code>grep</code> prints a diagnostic and exits with status 2, on
+<p>If you mistakenly omit the outer brackets, and search for say, ‘<samp
class="samp">[:upper:]</samp>’,
+GNU <code class="command">grep</code> prints a diagnostic and exits with
status 2, on
the assumption that you did not intend to search for the
-regular expression ‘<samp>[:epru]</samp>’.
+regular expression ‘<samp class="samp">[:epru]</samp>’.
</p>
<p>Special characters lose their special meaning inside bracket expressions.
</p>
-<dl compact="compact">
-<dt><span>‘<samp>]</samp>’</span></dt>
+<dl class="table">
+<dt>‘<samp class="samp">]</samp>’</dt>
<dd><p>ends the bracket expression if it’s not the first list item.
-So, if you want to make the ‘<samp>]</samp>’ character a list item,
+So, if you want to make the ‘<samp class="samp">]</samp>’
character a list item,
you must put it first.
</p>
</dd>
-<dt><span>‘<samp>[.</samp>’</span></dt>
+<dt>‘<samp class="samp">[.</samp>’</dt>
<dd><p>represents the open collating symbol.
</p>
</dd>
-<dt><span>‘<samp>.]</samp>’</span></dt>
+<dt>‘<samp class="samp">.]</samp>’</dt>
<dd><p>represents the close collating symbol.
</p>
</dd>
-<dt><span>‘<samp>[=</samp>’</span></dt>
+<dt>‘<samp class="samp">[=</samp>’</dt>
<dd><p>represents the open equivalence class.
</p>
</dd>
-<dt><span>‘<samp>=]</samp>’</span></dt>
+<dt>‘<samp class="samp">=]</samp>’</dt>
<dd><p>represents the close equivalence class.
</p>
</dd>
-<dt><span>‘<samp>[:</samp>’</span></dt>
+<dt>‘<samp class="samp">[:</samp>’</dt>
<dd><p>represents the open character class symbol, and should be followed by a
valid character class name.
</p>
</dd>
-<dt><span>‘<samp>:]</samp>’</span></dt>
+<dt>‘<samp class="samp">:]</samp>’</dt>
<dd><p>represents the close character class symbol.
</p>
</dd>
-<dt><span>‘<samp>-</samp>’</span></dt>
+<dt>‘<samp class="samp">-</samp>’</dt>
<dd><p>represents the range if it’s not first or last in a list or the
ending point
-of a range. To make the ‘<samp>-</samp>’ a list item, it is best
to put it last.
+of a range. To make the ‘<samp class="samp">-</samp>’ a list
item, it is best to put it last.
</p>
</dd>
-<dt><span>‘<samp>^</samp>’</span></dt>
+<dt>‘<samp class="samp">^</samp>’</dt>
<dd><p>represents the characters not in the list.
-If you want to make the ‘<samp>^</samp>’
+If you want to make the ‘<samp class="samp">^</samp>’
character a list item, place it anywhere but first.
</p>
</dd>
@@ -242,7 +242,7 @@
</div>
<hr>
-<div class="header">
+<div class="nav-panel">
<p>
Next: <a href="Special-Backslash-Expressions.html">Special Backslash
Expressions</a>, Previous: <a href="Fundamental-Structure.html">Fundamental
Structure</a>, Up: <a href="Regular-Expressions.html">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>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Changes to grep/manual/html_node/Character-Classes-and-Bracket-Expressions.html, v,
Jim Meyering <=