summaryrefslogtreecommitdiff
path: root/devdocs/elisp/rx-functions.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/elisp/rx-functions.html
new repository
Diffstat (limited to 'devdocs/elisp/rx-functions.html')
-rw-r--r--devdocs/elisp/rx-functions.html19
1 files changed, 19 insertions, 0 deletions
diff --git a/devdocs/elisp/rx-functions.html b/devdocs/elisp/rx-functions.html
new file mode 100644
index 00000000..cfe91f13
--- /dev/null
+++ b/devdocs/elisp/rx-functions.html
@@ -0,0 +1,19 @@
+ <h4 class="subsubsection">Functions and macros using rx regexps</h4> <dl> <dt id="rx">Macro: <strong>rx</strong> <em>rx-form…</em>
+</dt> <dd>
+<p>Translate the <var>rx-form</var>s to a string regexp, as if they were the body of a <code>(seq …)</code> form. The <code>rx</code> macro expands to a string constant, or, if <code>literal</code> or <code>regexp</code> forms are used, a Lisp expression that evaluates to a string. Example: </p> <div class="example"> <pre class="example">(rx (+ alpha) "=" (+ digit))
+ ⇒ "[[:alpha:]]+=[[:digit:]]+"
+</pre>
+</div> </dd>
+</dl> <dl> <dt id="rx-to-string">Function: <strong>rx-to-string</strong> <em>rx-expr &amp;optional no-group</em>
+</dt> <dd>
+<p>Translate <var>rx-expr</var> to a string regexp which is returned. If <var>no-group</var> is absent or nil, bracket the result in a non-capturing group, ‘<samp>\(?:…\)</samp>’, if necessary to ensure that a postfix operator appended to it will apply to the whole expression. Example: </p> <div class="example"> <pre class="example">(rx-to-string '(seq (+ alpha) "=" (+ digit)) t)
+ ⇒ "[[:alpha:]]+=[[:digit:]]+"
+</pre>
+</div> <p>Arguments to <code>literal</code> and <code>regexp</code> forms in <var>rx-expr</var> must be string literals. </p>
+</dd>
+</dl> <p>The <code>pcase</code> macro can use <code>rx</code> expressions as patterns directly; see <a href="pcase-macro#rx-in-pcase">rx in pcase</a>. </p> <p>For mechanisms to add user-defined extensions to the <code>rx</code> notation, see <a href="extending-rx">Extending Rx</a>. </p><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright &copy; 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br>
+ <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Rx-Functions.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Rx-Functions.html</a>
+ </p>
+</div>