CVSROOT: /webcvs/grep Module name: grep Changes by: Jim Meyering <meyering> 22/09/03 15:33:15
Index: html_node/Special-Backslash-Expressions.html =================================================================== RCS file: html_node/Special-Backslash-Expressions.html diff -N html_node/Special-Backslash-Expressions.html --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ html_node/Special-Backslash-Expressions.html 3 Sep 2022 19:33:14 -0000 1.1 @@ -0,0 +1,130 @@ +<!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-2022 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". --> +<title>Special Backslash Expressions (GNU Grep 3.8)</title> + +<meta name="description" content="Special Backslash Expressions (GNU Grep 3.8)"> +<meta name="keywords" content="Special Backslash Expressions (GNU Grep 3.8)"> +<meta name="resource-type" content="document"> +<meta name="distribution" content="global"> +<meta name="Generator" content="makeinfo"> +<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" rel="up" title="Regular Expressions"> +<link href="Anchoring.html" rel="next" title="Anchoring"> +<link href="Character-Classes-and-Bracket-Expressions.html" rel="prev" title="Character Classes and Bracket Expressions"> +<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} +--> +</style> +<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css"> + + +</head> + +<body lang="en"> +<div class="section" id="Special-Backslash-Expressions"> +<div class="header"> +<p> +Next: <a href="Anchoring.html" accesskey="n" rel="next">Anchoring</a>, Previous: <a href="Character-Classes-and-Bracket-Expressions.html" accesskey="p" rel="prev">Character Classes and Bracket Expressions</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="Special-Backslash-Expressions-1"></span><h3 class="section">3.3 Special Backslash Expressions</h3> +<span id="index-backslash"></span> + +<p>The ‘<samp>\</samp>’ character followed by a special character is a regular +expression that matches the special character. +The ‘<samp>\</samp>’ character, +when followed by certain ordinary characters, +takes a special meaning: +</p> +<dl compact="compact"> +<dt><span>‘<samp>\b</samp>’</span></dt> +<dd><p>Match the empty string at the edge of a word. +</p> +</dd> +<dt><span>‘<samp>\B</samp>’</span></dt> +<dd><p>Match the empty string provided it’s not at the edge of a word. +</p> +</dd> +<dt><span>‘<samp>\<</samp>’</span></dt> +<dd><p>Match the empty string at the beginning of a word. +</p> +</dd> +<dt><span>‘<samp>\></samp>’</span></dt> +<dd><p>Match the empty string at the end of a word. +</p> +</dd> +<dt><span>‘<samp>\w</samp>’</span></dt> +<dd><p>Match word constituent, it is a synonym for ‘<samp>[_[:alnum:]]</samp>’. +</p> +</dd> +<dt><span>‘<samp>\W</samp>’</span></dt> +<dd><p>Match non-word constituent, it is a synonym for ‘<samp>[^_[:alnum:]]</samp>’. +</p> +</dd> +<dt><span>‘<samp>\s</samp>’</span></dt> +<dd><p>Match whitespace, it is a synonym for ‘<samp>[[:space:]]</samp>’. +</p> +</dd> +<dt><span>‘<samp>\S</samp>’</span></dt> +<dd><p>Match non-whitespace, it is a synonym for ‘<samp>[^[:space:]]</samp>’. +</p> +</dd> +<dt><span>‘<samp>\]</samp>’</span></dt> +<dd><p>Match ‘<samp>]</samp>’. +</p> +</dd> +<dt><span>‘<samp>\}</samp>’</span></dt> +<dd><p>Match ‘<samp>}</samp>’. +</p> +</dd> +</dl> + +<p>For example, ‘<samp>\brat\b</samp>’ matches the separate word ‘<samp>rat</samp>’, +‘<samp>\Brat\B</samp>’ matches ‘<samp>crate</samp>’ but not ‘<samp>furry rat</samp>’. +</p> +<p>The behavior of <code>grep</code> is unspecified if a unescaped backslash +is not followed by a special character, a nonzero digit, or a +character in the above list. Although <code>grep</code> might issue a +diagnostic and/or give the backslash an interpretation now, its +behavior may change if the syntax of regular expressions is extended +in future versions. +</p> +</div> + + + +</body> +</html>
