emacs-devel
[Top][All Lists]
Advanced

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

Re: rx.el sexp regexp syntax


From: Michael Heerdegen
Subject: Re: rx.el sexp regexp syntax
Date: Fri, 25 May 2018 23:01:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Alan Mackenzie <address@hidden> writes:

>  A string regexp, by contrast, usually fits onto a single line.

But regexps are tree-like structures.  That's why rx, which uses sexps
(i.e. trees), is the easier to read representation for complicated
regexps than a one-dimensional string.  Unless you have the ability to
form a representation in your head.

> The "English" counterpart used in rx is bulky and difficult to learn.
> Somehow, you've got to learn that it's "word-start" and not
> "word-beginning", that it's "not" and not "non", and so on.

That's IMHO the main reason why people avoid using rx.  I wonder if that
aspect of rx could be improved (why not just use $ as synonym for bol
etc.)?

> This is more difficult than just learning \< and ^.  If your native
> language isn't English, it might be much more difficult.

But also because you read the former more often.

OTOH btw, I find the documentation for rx more condensed than that of
the syntax of regexps.


In summary, I think both representations have their justification of
existence.


Michael.



reply via email to

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