diff options
| author | Stefan Monnier | 2019-03-21 08:27:39 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2019-03-21 08:27:39 -0400 |
| commit | c569cceb2d334564d320d2b4098c855db7eb88a0 (patch) | |
| tree | f69d3c89a4a426f0f92131739fab07b599dbfd2f | |
| parent | 1fc6afbdf1ce0f8b23780bd4d2630ed49f365013 (diff) | |
| download | emacs-c569cceb2d334564d320d2b4098c855db7eb88a0.tar.gz emacs-c569cceb2d334564d320d2b4098c855db7eb88a0.zip | |
* doc: Recommend putting '-' as last char in Emacs charset regexps
* doc/lispref/searching.texi (Regexp Special):
* doc/emacs/search.texi (Regexps): Recommend - as last char in [...].
| -rw-r--r-- | doc/emacs/search.texi | 9 | ||||
| -rw-r--r-- | doc/lispref/searching.texi | 14 |
2 files changed, 11 insertions, 12 deletions
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 9c58ef471fe..a1c987c1252 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi | |||
| @@ -974,11 +974,10 @@ character class inside a character alternative. For instance, | |||
| 974 | elisp, The Emacs Lisp Reference Manual}, for a list of character | 974 | elisp, The Emacs Lisp Reference Manual}, for a list of character |
| 975 | classes. | 975 | classes. |
| 976 | 976 | ||
| 977 | To include a @samp{]} in a character set, you must make it the first | 977 | To include a @samp{]} in a character set, you must make it the first character. |
| 978 | character. For example, @samp{[]a]} matches @samp{]} or @samp{a}. To | 978 | For example, @samp{[]a]} matches @samp{]} or @samp{a}. To include a @samp{-}, |
| 979 | include a @samp{-}, write @samp{-} as the first or last character of the | 979 | write @samp{-} as the last character of the set, tho you can also put it first |
| 980 | set, or put it after a range. Thus, @samp{[]-]} matches both @samp{]} | 980 | or after a range. Thus, @samp{[]-]} matches both @samp{]} and @samp{-}. |
| 981 | and @samp{-}. | ||
| 982 | 981 | ||
| 983 | To include @samp{^} in a set, put it anywhere but at the beginning of | 982 | To include @samp{^} in a set, put it anywhere but at the beginning of |
| 984 | the set. (At the beginning, it complements the set---see below.) | 983 | the set. (At the beginning, it complements the set---see below.) |
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 740be2a31ff..0f312915f9e 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi | |||
| @@ -406,13 +406,13 @@ Note also that the usual regexp special characters are not special inside a | |||
| 406 | character alternative. A completely different set of characters is | 406 | character alternative. A completely different set of characters is |
| 407 | special inside character alternatives: @samp{]}, @samp{-} and @samp{^}. | 407 | special inside character alternatives: @samp{]}, @samp{-} and @samp{^}. |
| 408 | 408 | ||
| 409 | To include a @samp{]} in a character alternative, you must make it the | 409 | To include a @samp{]} in a character alternative, you must make it the first |
| 410 | first character. For example, @samp{[]a]} matches @samp{]} or @samp{a}. | 410 | character. For example, @samp{[]a]} matches @samp{]} or @samp{a}. To include |
| 411 | To include a @samp{-}, write @samp{-} as the first or last character of | 411 | a @samp{-}, write @samp{-} as the last character of the character alternative, |
| 412 | the character alternative, or put it after a range. Thus, @samp{[]-]} | 412 | tho you can also put it first or after a range. Thus, @samp{[]-]} matches both |
| 413 | matches both @samp{]} and @samp{-}. (As explained below, you cannot | 413 | @samp{]} and @samp{-}. (As explained below, you cannot use @samp{\]} to |
| 414 | use @samp{\]} to include a @samp{]} inside a character alternative, | 414 | include a @samp{]} inside a character alternative, since @samp{\} is not |
| 415 | since @samp{\} is not special there.) | 415 | special there.) |
| 416 | 416 | ||
| 417 | To include @samp{^} in a character alternative, put it anywhere but at | 417 | To include @samp{^} in a character alternative, put it anywhere but at |
| 418 | the beginning. | 418 | the beginning. |