A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.gnu.org/software/emacs/manual/html_node/elisp/Rx-Functions.html below:

Rx Functions (GNU Emacs Lisp Reference Manual)

Next: Defining new rx forms, Previous: Constructs in rx regexps, Up: The rx Structured Regexp Notation   [Contents][Index]

35.3.3.2 Functions and macros using rx regexps
Macro: rx rx-form…

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 literal or regexp forms are used, a Lisp expression that evaluates to a string. Example:

(rx (+ alpha) "=" (+ digit))
  ⇒ "[[:alpha:]]+=[[:digit:]]+"
Function: rx-to-string rx-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. Example:

(rx-to-string '(seq (+ alpha) "=" (+ digit)) t)
  ⇒ "[[:alpha:]]+=[[:digit:]]+"

Arguments to literal and regexp forms in rx-expr must be string literals.

The pcase macro can use rx expressions as patterns directly; see rx in pcase.

For mechanisms to add user-defined extensions to the rx notation, see Defining new rx forms.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4