Commit ac1ad3e4 authored by Mattias Engdegård's avatar Mattias Engdegård

Describe the rx notation in the elisp manual (bug#36496)

The additions are excluded from the print version to avoid making it
thicker.

* doc/lispref/elisp.texi (Top): New menu entry.
* doc/lispref/searching.texi (Regular Expressions): New menu entry.
(Regexp Example): Add rx form of the example.
(Rx Notation, Rx Constructs, Rx Functions): New nodes.
* doc/lispref/control.texi (pcase Macro): Describe the rx pattern.
parent b39f5e6c
......@@ -618,6 +618,31 @@ To present a consistent environment (@pxref{Intro Eval})
to @var{body-forms} (thus avoiding an evaluation error on match),
if any of the sub-patterns let-binds a set of symbols,
they @emph{must} all bind the same set of symbols.
@ifnottex
@anchor{rx in pcase}
@item (rx @var{rx-expr}@dots{})
Matches strings against the regexp @var{rx-expr}@dots{}, using the
@code{rx} regexp notation (@pxref{Rx Notation}), as if by
@code{string-match}.
In addition to the usual @code{rx} syntax, @var{rx-expr}@dots{} can
contain the following constructs:
@table @code
@item (let @var{ref} @var{rx-expr}@dots{})
Bind the symbol @var{ref} to a submatch that matches
@var{rx-expr}@enddots{}. @var{ref} is bound in @var{body-forms} to
the string of the submatch or nil, but can also be used in
@code{backref}.
@item (backref @var{ref})
Like the standard @code{backref} construct, but @var{ref} can here
also be a name introduced by a previous @code{(let @var{ref} @dots{})}
construct.
@end table
@end ifnottex
@end table
@anchor{pcase-example-0}
......
......@@ -1298,6 +1298,9 @@ Regular Expressions
* Syntax of Regexps:: Rules for writing regular expressions.
* Regexp Example:: Illustrates regular expression syntax.
@ifnottex
* Rx Notation:: An alternative, structured regexp notation.
@end ifnottex
* Regexp Functions:: Functions for operating on regular expressions.
Syntax of Regular Expressions
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment