emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: modern regexes in emacs


From: Juri Linkov
Subject: Re: modern regexes in emacs
Date: Sun, 17 Feb 2019 22:01:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

> If I read the petitioners correctly, they want a global setting that
> permits them to type a(b|c) instead of a\(b\|c\) in isearch-forward-regexp
> and all other interactive commands.

This would be really trivial to do when we'll have a function that
will convert an extended regexp string into rx form like what
the xr package does, i.e. like the function ‘xr’, a new function
‘exr’ could convert an extended regexp - as opposed to basic regexp
as noted in https://www.regular-expressions.info/gnu.html

Then similarly to ‘isearch-symbol-regexp’, the implementation will be just
4 lines:

  (isearch-define-mode-toggle extended "\\" isearch-extended-regexp "\
  Turning on extended regexp search turns off basic regexp mode.")

  (defun isearch-extended-regexp (string)
    (rx (exr string)))

that will also automatically support extended regexp interactively in
occur, query-replace-regexp...



reply via email to

[Prev in Thread] Current Thread [Next in Thread]