all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to grok a complicated regex?
@ 2015-03-14  8:16 martin rudalics
  0 siblings, 0 replies; 24+ messages in thread
From: martin rudalics @ 2015-03-14  8:16 UTC (permalink / raw)
  To: mbork; +Cc: help-gnu-emacs

 > so I have this monstrosity [note: I know, there are much worse ones,
 > too!]:
 >
 > "\\`\\(?:\\\\[([]\\|\\$+\\)?\\(.*?\\)\\(?:\\\\[])]\\|\\$+\\)?\\'"
 >
 > (it's in the org-latex--script-size function in ox-latex.el, if you're
 > curious).
 >
 > I'm not asking “what does this match” – I can read it myself.  But it
 > comes with a considerable effort.  Are you aware of any tools that might
 > help to understand such regexen?

You might want to try regexp-lock.el which you can find here:

https://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00688.html

Eventually it should also appear on ELPA but I have to polish up some
things first.

Sincerely, martin




^ permalink raw reply	[flat|nested] 24+ messages in thread
* How to grok a complicated regex?
@ 2015-03-13 21:35 Marcin Borkowski
  2015-03-13 21:45 ` Marcin Borkowski
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Marcin Borkowski @ 2015-03-13 21:35 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi all,

so I have this monstrosity [note: I know, there are much worse ones,
too!]:

"\\`\\(?:\\\\[([]\\|\\$+\\)?\\(.*?\\)\\(?:\\\\[])]\\|\\$+\\)?\\'"

(it's in the org-latex--script-size function in ox-latex.el, if you're
curious).

I'm not asking “what does this match” – I can read it myself.  But it
comes with a considerable effort.  Are you aware of any tools that might
help to understand such regexen?

I know about re-builder, but it’s well suited for constructing a regex
matching a given string, not the other way round.

For instance, show-paren-mode does not really help here, since it seems
to pair “\\(“ with unescaped “)”.

Any ideas?

(Note: if there are no such tools, I might be tempted to craft one.  Two
things that come to my mind are proper highlighting of matching parens
of various kinds and eldoc-like hints for all the regex constructs –
I never seem to remember what does “\\`” do, for instance.  Also,
displaying the string with single backslashes and not in the way it is
actually typed in in Elisp, with all the backslash escaping, might be
helpful.  Would there be a demand for such a tool larger than one
person?)

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2015-04-27 13:26 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.