From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Vaidheeswaran C Newsgroups: gmane.emacs.help Subject: Re: How to grok a complicated regex? Date: Mon, 23 Mar 2015 17:48:41 +0530 Message-ID: References: <87ioe4a8d3.fsf@wmi.amu.edu.pl> Reply-To: vaidheeswaran.chinnaraju@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1427113094 13793 80.91.229.3 (23 Mar 2015 12:18:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 23 Mar 2015 12:18:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 23 13:18:05 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ya1Ix-00061A-J8 for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Mar 2015 13:18:03 +0100 Original-Received: from localhost ([::1]:55419 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya1Iw-0002EI-Qs for geh-help-gnu-emacs@m.gmane.org; Mon, 23 Mar 2015 08:18:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49200) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya1IV-0001vB-12 for help-gnu-emacs@gnu.org; Mon, 23 Mar 2015 08:17:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ya1IS-00051S-A3 for help-gnu-emacs@gnu.org; Mon, 23 Mar 2015 08:17:34 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:34652) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ya1IS-00051H-3m for help-gnu-emacs@gnu.org; Mon, 23 Mar 2015 08:17:32 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Ya1IG-0005YK-Os for help-gnu-emacs@gnu.org; Mon, 23 Mar 2015 13:17:20 +0100 Original-Received: from 223.180.64.114 ([223.180.64.114]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 23 Mar 2015 13:17:20 +0100 Original-Received: from vaidheeswaran.chinnaraju by 223.180.64.114 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 23 Mar 2015 13:17:20 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 43 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 223.180.64.114 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.3.0 In-Reply-To: <87ioe4a8d3.fsf@wmi.amu.edu.pl> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103268 Archived-At: On Saturday 14 March 2015 03:05 AM, Marcin Borkowski wrote: > > "\\`\\(?:\\\\[([]\\|\\$+\\)?\\(.*?\\)\\(?:\\\\[])]\\|\\$+\\)?\\'" > > (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? Get xr.el from http://debbugs.gnu.org/cgi/bugreport.cgi?msg=40;filename=xr.el;att=1;bug=13369 M-x load-library xr.el M-x pp-eval-expression RET (xr "\\`\\(?:\\\\[([]\\|\\$+\\)?\\(.*?\\)\\(?:\\\\[])]\\|\\$+\\)?\\'") RET (seq bos (opt (or (seq "\\" (any "[" "(")) (one-or-more "$"))) (group (minimal-match (zero-or-more nonl))) (opt (or (seq "\\" (any ")" "]")) (one-or-more "$"))) eos) There is also lex (see http://elpa.gnu.org/packages/lex.html) which provides similar functionality. FWIW, my edit window "disappears" if I do (lex-parse-re "\\`\\(?:\\\\[([]\\|\\$+\\)?\\(.*?\\)\\(?:\\\\[])]\\|\\$+\\)?\\'")