summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/rx.el
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2018-07-20 10:00:32 -0700
committerGlenn Morris <rgm@gnu.org>2018-07-20 10:00:32 -0700
commit6ee00324619673b402dadb3c28e791b79527868f (patch)
tree57070a6bb9dcf0620107f113f67551fe622c7385 /lisp/emacs-lisp/rx.el
parent144bcc0132e61cc932348312720d592764022844 (diff)
parent3e722980df9d4a705394c843a2a5e051e9c682b6 (diff)
downloademacs-6ee00324619673b402dadb3c28e791b79527868f.tar.gz
emacs-6ee00324619673b402dadb3c28e791b79527868f.tar.bz2
emacs-6ee00324619673b402dadb3c28e791b79527868f.zip
Merge from origin/emacs-26
3e72298 Improve documentation of 'pcase-defmacro rx' ba9b9bb Fix TTY colors breakage by 'clear-face-cache' f56ad42 * admin/MAINTAINERS: Add files maintained by me (Michael Albi... 7a258fa Adapt shadowfile.el for Tramp (Bug#4526, Bug#4846) cb50077 Fix auth-source-delete (Bug#26184) a4767a6 Avoid assertion violations in gnutls.c 90110f8 Don't use a literal "C-u" in ispell.el help message text f4e7f6d Improve documentation of 'seqp' ed13639 Clarify usage and dependencies between several Flyspell features Conflicts: etc/NEWS test/lisp/auth-source-tests.el
Diffstat (limited to 'lisp/emacs-lisp/rx.el')
-rw-r--r--lisp/emacs-lisp/rx.el32
1 files changed, 18 insertions, 14 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 85e74f28ef0..bb759011513 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -1183,24 +1183,28 @@ enclosed in `(and ...)'.
(pcase-defmacro rx (&rest regexps)
- "Build a `pcase' pattern matching `rx' regexps.
-The REGEXPS are interpreted as by `rx'. The pattern matches if
-the regular expression so constructed matches EXPVAL, as if
-by `string-match'.
+ "Build a `pcase' pattern matching `rx' REGEXPS in sexp form.
+The REGEXPS are interpreted as in `rx'. The pattern matches any
+string that is a match for the regular expression so constructed,
+as if by `string-match'.
In addition to the usual `rx' constructs, REGEXPS can contain the
following constructs:
- (let VAR FORM...) creates a new explicitly numbered submatch
- that matches FORM and binds the match to
- VAR.
- (backref VAR) creates a backreference to the submatch
- introduced by a previous (let VAR ...)
- construct.
-
-The VARs are associated with explicitly numbered submatches
-starting from 1. Multiple occurrences of the same VAR refer to
-the same submatch.
+ (let REF SEXP...) creates a new explicitly named reference to
+ a submatch that matches regular expressions
+ SEXP, and binds the match to REF.
+ (backref REF) creates a backreference to the submatch
+ introduced by a previous (let REF ...)
+ construct. REF can be the same symbol
+ in the first argument of the corresponding
+ (let REF ...) construct, or it can be a
+ submatch number. It matches the referenced
+ submatch.
+
+The REFs are associated with explicitly named submatches starting
+from 1. Multiple occurrences of the same REF refer to the same
+submatch.
If a case matches, the match data is modified as usual so you can
use it in the case body, but you still have to pass the correct