[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: rx.el sexp regexp syntax
From: |
Stefan Monnier |
Subject: |
Re: rx.el sexp regexp syntax |
Date: |
Sun, 27 May 2018 16:16:47 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> rx.el is one of the best concepts I've discovered in a long time.
> It's another instance of "Don't come up with a new (mini)language when
> Lisp can do better": it's easier to learn, more flexible, easier to
> write, much easier to read and as a consequence much more maintainable.
FWIW, I find it's cumbersome in RX to define regexps piecewise.
E.g. with strings I can do things like:
(let* ((word-re "\\(?:\\sw\\|s_\\)+")
(spc-re "[ \t\n]*")
(re1 (concat spc-re "\\(" word-re "\\)" spc-re))
(re2 (concat spc-re "\\(" word-re "\\)(" word-re))))
but do the same with RX you need something like:
(let* ((word-re (rx ...))
(spc-re (rx ...))
(re1 (rx-to-string `(... ,spc-re ... ,word-re ...)))
(re2 (rx-to-string `(... ,spc-re ... ,word-re ...))))
I think `rx` would benefit from allowing to refer to variables.
Stefan
- Re: rx.el sexp regexp syntax, (continued)
- Re: rx.el sexp regexp syntax, Philipp Stephani, 2018/05/29
- Re: rx.el sexp regexp syntax (WAS: Off Topic), Alan Mackenzie, 2018/05/25
- Re: rx.el sexp regexp syntax, Michael Heerdegen, 2018/05/25
- Re: rx.el sexp regexp syntax, Peter Neidhardt, 2018/05/25
- Re: rx.el sexp regexp syntax (WAS: Off Topic), Peter Neidhardt, 2018/05/25
- Re: rx.el sexp regexp syntax, Tom Tromey, 2018/05/27
- Re: rx.el sexp regexp syntax, Alan Mackenzie, 2018/05/27
- Re: rx.el sexp regexp syntax, Stefan Monnier, 2018/05/27
- Re: rx.el sexp regexp syntax,
Stefan Monnier <=
- Re: rx.el sexp regexp syntax, Pierre Neidhardt, 2018/05/28
- Re: rx.el sexp regexp syntax, Stefan Monnier, 2018/05/28