Translate the rx-forms to a string regexp, as if they were the
body of a
(seq …) form. The
rx macro expands to a
string constant, or, if
regexp forms are
used, a Lisp expression that evaluates to a string. Example:
(rx (+ alpha) "=" (+ digit)) ⇒ "[[:alpha:]]+=[[:digit:]]+"
rx-to-stringrx-expr &optional no-group ¶
Translate rx-expr to a string regexp which is returned.
If no-group is absent or
nil, bracket the result in a
non-capturing group, ‘\(?:…\)’, if necessary to ensure that
a postfix operator appended to it will apply to the whole expression.
(rx-to-string '(seq (+ alpha) "=" (+ digit)) t) ⇒ "[[:alpha:]]+=[[:digit:]]+"
regexp forms in rx-expr
must be string literals.
pcase macro can use
rx expressions as patterns
directly; see rx in pcase.
For mechanisms to add user-defined extensions to the
notation, see Defining new