docs: clarify that in nano regexes are extended regular expressions

And add a concise summary of the most important special characters.

This addresses https://savannah.gnu.org/bugs/?56438.
master
Benno Schulenberg 2019-06-06 15:00:34 +02:00
parent 378aa8bc41
commit 941637615b
3 changed files with 34 additions and 5 deletions

View File

@ -890,7 +890,8 @@ and Delete work properly. You should only use this option when on your
system either Backspace acts like Delete or Delete acts like Backspace.
@item set regexp
Do extended regular expression searches by default.
Do regular-expression searches by default.
Regular expressions in @command{nano} are of the extended type (ERE).
@item set selectedcolor @var{fgcolor},@var{bgcolor}
Use this color combination for selected text.
@ -989,6 +990,19 @@ powerful enough to fully parse a file. Nevertheless, regular
expressions can do a lot and are easy to make, so they are a
good fit for a small editor like @command{nano}.
All regular expressions in @command{nano} are extended regular expressions
(ERE). This means that @code{.}, @code{?}, @code{*}, @code{+}, @code{^},
@code{$}, and several other characters are special.
The period @code{.} matches any single character,
@code{?} means the preceding item is optional,
@code{*} means the preceding item may be matched zero or more times,
@code{+} means the preceding item must be matched one or more times,
@code{^} matches the beginning of a line, and @code{$} the end,
@code{\<} matches the start of a word, and @code{\>} the end,
and @code{\s} matches a blank.
It also means that lookahead and lookbehind are not possible.
A complete explanation can be found in @code{info grep regular}.
A separate syntax can be defined for each kind of file
via the following commands in a nanorc file:

View File

@ -238,7 +238,8 @@ and Delete work properly. You should only use this option when on your
system either Backspace acts like Delete or Delete acts like Backspace.
.TP
.B set regexp
Do extended regular expression searches by default.
Do regular-expression searches by default.
Regular expressions in \fBnano\fR are of the extended type (ERE).
.TP
.B set selectedcolor \fIfgcolor\fR,\fIbgcolor\fR
Specify the color combination to use for selected text.
@ -336,6 +337,19 @@ powerful enough to fully parse a file. Nevertheless, regular
expressions can do a lot and are easy to make, so they are a
good fit for a small editor like \fBnano\fR.
.sp
All regular expressions in \fBnano\fR are extended regular expressions (ERE).
This means that \fB.\fR, \fB?\fR, \fB*\fR, \fB+\fR, \fB^\fR, \fB$\fR, and
several other characters are special.
The period \fB.\fR matches any single character,
\fB?\fR means the preceding item is optional,
\fB*\fR means the preceding item may be matched zero or more times,
\fB+\fR means the preceding item must be matched one or more times,
\fB^\fR matches the beginning of a line, and \fB$\fR the end,
\fB\\<\fR matches the start of a word, and \fB\\>\fR the end,
and \fB\\s\fR matches a blank.
It also means that lookahead and lookbehind are not possible.
A complete explanation can be found in \fBman grep\fR.
.sp
For each kind of file a separate syntax can be defined
via the following commands:
.TP

View File

@ -135,7 +135,8 @@
## Fix Backspace/Delete confusion problem.
# set rebinddelete
## Do extended regular expression searches by default.
## Do regular-expression searches by default.
## Regular expressions are of the extended type (ERE).
# set regexp
## Put the cursor on the highlighted item in the file browser, and show
@ -239,6 +240,8 @@
## yellow, magenta, cyan. For foreground colors, you may use the
## prefix "bright" to get a stronger highlight.
##
## All regexes (regular expressions) are of the extended type (ERE).
##
## To use multi-line regexes, use the start="regex" end="regex"
## [start="regex" end="regex"...] format.
##
@ -246,8 +249,6 @@
## color will use a transparent color. If you don't want this, be sure
## to set the background color to black or white.
##
## All regexes should be extended regular expressions.
##
## If you wish, you may put your syntax definitions in separate files.
## You can make use of such files as follows:
##