[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make regexp handling more regular
From: |
Lars Ingebrigtsen |
Subject: |
Re: Make regexp handling more regular |
Date: |
Wed, 02 Dec 2020 11:44:52 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Lars Ingebrigtsen <larsi@gnus.org> writes:
> (when (setq match (rx-string-match "[a-z]" string))
> (foo)
> (bar (match match 0)))
This would, of course, be more idiomatic as
(when-let ((match (rx-string-match "[a-z]" string)))
(foo)
(bar (match match 0)))
Another thing that occurred to me is that we could allow the match
object accessors to return nil on nil objects. Then, what's currently
this:
(let ((string (foo)))
(and (string-match "[a-z]" string)
(match-string 0 string)))
would just be this:
(match (rx-string-match "[a-z]" (foo)) 0)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no