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

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

Re: [External] : Re: Package cl is deprecated


From: Michael Heerdegen
Subject: Re: [External] : Re: Package cl is deprecated
Date: Sat, 31 Jul 2021 03:34:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hongyi Zhao <hongyi.zhao@gmail.com> writes:

> > (require[
> >  ]+[.][
> >  ]+cl)
>
> Thank you for showing me this pattern. TBF, it seems to me that the
> syntax of line spanning match pattern is very strange. It would be
> nice if there were some explanation for how to build this pattern.

I suggest to use "xr" which is the reverse of `rx' which is a thing that
allows to construct regular expressions from a simple and well
documented symbolic description language (see doc of `rx').  So

(xr "(require[
 ]+[.][
 ]+cl)")

==>
 (seq "(require"
      (one-or-more (any "\n "))
      "."
      (one-or-more (any "\n "))
      "cl)")

As mentioned, see the help of `rx' to see what any part means, though
it's already quite readable.

Note that for regexp searching there is no Lisp interpreter involved
that would read your input string.  What you type is used directly,
which means that \n does not match a newline (but instead the character
"n").  That's why the search pattern includes real newlines.  This is
bit confusing at the beginning, anyway, that's already all, you can do
it ;-)


Michael.




reply via email to

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