[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to grok a complicated regex?
From: |
Marcin Borkowski |
Subject: |
Re: How to grok a complicated regex? |
Date: |
Fri, 13 Mar 2015 22:45:10 +0100 |
On 2015-03-13, at 22:35, Marcin Borkowski <mbork@wmi.amu.edu.pl> wrote:
> 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?
BTW, it turned out to be fairly simple after all, but I could see this
only after passing it through (insert ...) in a temporary buffer, so
that all the double backslashes stopped looking like a drunkard's
nightmare. So even such a rudimentary "tool" (basically, temp buffer
and `insert') did help a lot.
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University