From: Drew Adams <drew.adams@oracle.com>
To: Helmut Eller <eller.helmut@gmail.com>, emacs-devel@gnu.org
Subject: RE: rx.el sexp regexp syntax
Date: Sun, 3 Jun 2018 12:57:57 -0700 (PDT) [thread overview]
Message-ID: <fae5f17b-85c1-4049-8c0e-afbbebe60f06@default> (raw)
In-Reply-To: <m2wovfvpcz.fsf@gmail.com>
It's not just about confusion/obscurity due to the "extra"
backslashes (for `(', `)', and `|'). It's also about the
fact that regexps themselves can be complicated. For
example, `directory-listing-before-filename-regexp':
"\\([0-9][BkKMGTPEZY]? \\(\\([0-9][0-9][0-9][0-9]-\\)?[01][0-9]-[0-3][0-9][ T][ 0-2][0-9][:.][0-5][0-9]\\(:[0-6][0-9]\\([.,][0-9]+\\)?\\( ?[-+][0-2][0-9][0-5][0-9]\\)?\\)?\\|[0-9][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9]\\)\\|.*[0-9][BkKMGTPEZY]? \\(\\(\\([A-Za-z']\\|[^\0-\x7f]\\)\\([A-Za-z']\\|[^\0-\x7f]\\)+\\.? +[ 0-3][0-9]\\|[ 0-3][0-9]\\.? \\([A-Za-z']\\|[^\0-\x7f]\\)\\([A-Za-z']\\|[^\0-\x7f]\\)+\\.?\\) +\\([ 0-2][0-9][:.][0-5][0-9]\\|[0-9][0-9][0-9][0-9]\\)\\|\\([A-Za-z']\\|[^\0-\x7f]\\)\\([A-Za-z']\\|[^\0-\x7f]\\)+\\.? +[ 0-3][0-9], +[0-9][0-9][0-9][0-9]\\|\\([ 0-1]?[0-9]\\([A-Za-z]\\|[^\0-\x7f]\\)? [ 0-3][0-9]\\([A-Za-z]\\|[^\0-\x7f]\\)? +\\|[ 0-3][0-9] [ 0-1]?[0-9] +\\)\\([ 0-2][0-9][:.][0-5][0-9]\\|[0-9][0-9][0-9][0-9]\\([A-Za-z]\\|[^\0-\x7f]\\)?\\)\\)\\) +"
Even after removing "extra" backslashes, it's still a bear:
"([0-9][BkKMGTPEZY]? (([0-9][0-9][0-9][0-9]-)?[01][0-9]-[0-3][0-9][ T][ 0-2][0-9][:.][0-5][0-9](:[0-6][0-9]([.,][0-9]+)?( ?[-+][0-2][0-9][0-5][0-9])?)?|[0-9][0-9][0-9][0-9]-[01][0-9]-[0-3][0-9])|.*[0-9][BkKMGTPEZY]? ((([A-Za-z']|[^\0-\x7f])([A-Za-z']|[^\0-\x7f])+\\.? +[ 0-3][0-9]|[ 0-3][0-9]\\.? ([A-Za-z']|[^\0-\x7f])([A-Za-z']|[^\0-\x7f])+\\.?) +([ 0-2][0-9][:.][0-5][0-9]|[0-9][0-9][0-9][0-9])|([A-Za-z']|[^\0-\x7f])([A-Za-z']|[^\0-\x7f])+\\.? +[ 0-3][0-9], +[0-9][0-9][0-9][0-9]|([ 0-1]?[0-9]([A-Za-z]|[^\0-\x7f])? [ 0-3][0-9]([A-Za-z]|[^\0-\x7f])? +|[ 0-3][0-9] [ 0-1]?[0-9] +)([ 0-2][0-9][:.][0-5][0-9]|[0-9][0-9][0-9][0-9]([A-Za-z]|[^\0-\x7f])?))) +"
As I said before:
> Functions that transform a regexp string to an RX
> sexp and vice versa would be very helpful.
(And yes, the latter exists.)
Ideally, we'd have the ability to put your cursor on
a regexp in some code and hit a key to:
* see a corresponding `rx' sexp and
* optionally replace the regexp with the `rx' sexp.
Just being able to see the `rx' sexp that corresponds
to a regexp in some code (even temporarily in a popup)
could help, I think.
next prev parent reply other threads:[~2018-06-03 19:57 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-24 10:47 rx.el sexp regexp syntax (WAS: Off Topic) Noam Postavsky
2018-05-24 10:58 ` Van L
2018-05-25 2:57 ` Richard Stallman
2018-05-25 8:52 ` Pierre Neidhardt
2018-05-25 15:51 ` Alan Mackenzie
2018-05-25 16:47 ` Pierre Neidhardt
2018-05-25 18:01 ` rx.el sexp regexp syntax Eric Abrahamsen
2018-05-25 18:12 ` Pierre Neidhardt
2018-05-25 18:56 ` Eric Abrahamsen
2018-05-25 21:42 ` Clément Pit-Claudel
2018-05-25 21:51 ` Eric Abrahamsen
2018-05-25 22:27 ` Michael Heerdegen
2018-05-25 22:44 ` Eric Abrahamsen
2018-05-27 20:27 ` Stefan Monnier
2018-05-28 16:37 ` Pierre Neidhardt
2018-05-28 17:15 ` Stefan Monnier
2018-05-29 3:10 ` Richard Stallman
2018-05-29 7:28 ` Robert Pluim
2018-05-29 8:27 ` Philipp Stephani
2018-05-30 3:24 ` Richard Stallman
2018-05-30 7:25 ` Robert Pluim
2018-05-31 3:53 ` Richard Stallman
2018-05-31 8:57 ` Robert Pluim
2018-05-31 4:13 ` Clément Pit-Claudel
2018-05-31 14:19 ` Stefan Monnier
2018-05-31 15:43 ` Drew Adams
2018-05-31 16:12 ` João Távora
2018-05-31 16:18 ` Robert Pluim
2018-05-31 16:48 ` Basil L. Contovounesios
2018-05-31 17:02 ` Basil L. Contovounesios
2018-05-31 18:40 ` João Távora
2018-06-02 19:33 ` Eric Abrahamsen
2018-06-03 3:49 ` Stefan Monnier
2018-06-03 4:59 ` Eric Abrahamsen
2018-06-03 14:51 ` Helmut Eller
2018-06-03 15:15 ` Eric Abrahamsen
2018-06-03 15:53 ` Helmut Eller
2018-06-03 16:40 ` Eric Abrahamsen
2018-06-03 19:57 ` Drew Adams [this message]
2018-06-03 21:15 ` Eric Abrahamsen
2018-06-03 23:23 ` Drew Adams
2018-06-04 13:56 ` Stefan Monnier
2018-06-04 15:24 ` Drew Adams
2018-06-04 15:44 ` Pierre Neidhardt
2018-05-25 18:17 ` rx.el sexp regexp syntax (WAS: Off Topic) Alan Mackenzie
2018-05-25 20:35 ` Peter Neidhardt
2018-05-25 21:01 ` rx.el sexp regexp syntax Michael Heerdegen
2018-05-25 23:32 ` Peter Neidhardt
2018-05-27 16:56 ` Tom Tromey
2018-05-27 20:16 ` Alan Mackenzie
2018-05-27 20:23 ` Stefan Monnier
2018-05-27 20:16 ` Stefan Monnier
2018-05-28 16:36 ` Pierre Neidhardt
2018-05-28 17:04 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fae5f17b-85c1-4049-8c0e-afbbebe60f06@default \
--to=drew.adams@oracle.com \
--cc=eller.helmut@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).