From: Tassilo Horn <tsdh@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to grok a complicated regex?
Date: Thu, 19 Mar 2015 09:15:54 +0100 [thread overview]
Message-ID: <87h9th8ksl.fsf@gnu.org> (raw)
In-Reply-To: <mec9q3$g8o$1@colin.muc.de> (Alan Mackenzie's message of "Wed, 18 Mar 2015 16:40:35 +0000 (UTC)")
Alan Mackenzie <acm@muc.de> writes:
> I wrote myself the following tool. It's not production quality, but
> you might find it useful nonetheless. To use it, Type
>
> M-: (pp-regexp re-horror).
>
> It displays the regexp at the end of the *scratch* buffer, dropping
> the contents of any \(..\) construct by one line.
Interesting idea, and it helps a bit. What would be really cool was a
transformation from regexp to rx form. Oh, and that seems to exist
already (available from Marmalade and MELPA)!
https://github.com/joddie/pcre2el
Example:
--8<---------------cut here---------------start------------->8---
(rxt-elisp-to-rx "\\`\\(?:\\\\[([]\\|\\$+\\)?\\(.*?\\)\\(?:\\\\[])]\\|\\$+\\)?\\'")
;; Evals to...
(seq bos
(\? (or (seq "\\" (any "[" "("))
(+ "$")))
(submatch (*\? nonl))
(\? (or (seq "\\" (any ")" "]"))
(+ "$")))
eos)
--8<---------------cut here---------------end--------------->8---
Bye,
Tassilo
next prev parent reply other threads:[~2015-03-19 8:15 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.1979.1426282552.31049.help-gnu-emacs@gnu.org>
2015-03-13 22:46 ` How to grok a complicated regex? Emanuel Berg
2015-03-13 23:16 ` Marcin Borkowski
2015-03-14 0:12 ` Rasmus
2015-03-14 13:18 ` Stefan Monnier
[not found] ` <mailman.2003.1426339118.31049.help-gnu-emacs@gnu.org>
2015-03-15 4:31 ` Rusi
2015-03-22 2:29 ` Tom Tromey
2015-03-22 2:44 ` Rasmus
2015-03-14 5:14 ` Yuri Khan
2015-03-14 7:03 ` Drew Adams
[not found] ` <mailman.1984.1426288628.31049.help-gnu-emacs@gnu.org>
2015-03-14 3:58 ` Emanuel Berg
2015-03-14 4:44 ` Emanuel Berg
2015-03-14 4:58 ` Emanuel Berg
2015-03-14 8:43 ` Thien-Thi Nguyen
[not found] ` <mailman.1997.1426324089.31049.help-gnu-emacs@gnu.org>
2015-03-20 1:05 ` Emanuel Berg
2015-03-18 16:40 ` Alan Mackenzie
2015-03-19 8:15 ` Tassilo Horn [this message]
2015-04-25 4:23 ` Rusi
2015-04-27 13:26 ` Julien Cubizolles
2015-03-14 8:16 martin rudalics
-- strict thread matches above, loose matches on Subject: below --
2015-03-13 21:35 Marcin Borkowski
2015-03-13 21:45 ` Marcin Borkowski
2015-03-13 21:47 ` Alexis
2015-03-13 21:57 ` Marcin Borkowski
2015-03-23 12:18 ` Vaidheeswaran C
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=87h9th8ksl.fsf@gnu.org \
--to=tsdh@gnu.org \
--cc=acm@muc.de \
--cc=help-gnu-emacs@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.
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).