help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Making a regex string that matches (


From: Eduardo Ochs
Subject: Re: Making a regex string that matches (
Date: Fri, 11 Mar 2022 20:43:45 -0300

On Thu, 10 Mar 2022 at 11:31, angelomolina--- via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> How can I make a regex string if I want to search for (.


On Thu, 10 Mar 2022 at 11:31, angelomolina--- via Users list for the
GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
>
> How can I make a regex string if I want to search for (.

Hi Angelo,

Slightly off-topic, but I learned a lot about obscure-ish regexp
tricks by using rx and xr to convert regexps to the rx notation and
back... see:

  (info "(elisp)Rx Notation")
  https://github.com/mattiase/xr

Try:

  (rx "/*"
      (zero-or-more
       (or (not (any "*"))
           (seq "*" (not (any "/")))))
      (one-or-more "*")
      "/")

  (xr "/\\*\\(?:[^*]\\|\\*[^/]\\)*\\*+/")
  (xr find-function-regexp)

Here are some examples of things that I didn't know how to write in
regexp syntax, and that I only discovered using rx:

  (rx (any "[]"))
  (rx (any ""))
  (rx (not (any "")))

Now let's wait for Emanuel Berg's reaction... =)

  Cheers,
    Eduardo Ochs
    http://angg.twu.net/#eev



reply via email to

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