From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: [BUG] in org-property-drawer-re? Date: Wed, 02 Oct 2013 11:55:20 +0200 Message-ID: <87li2ct2t3.fsf@gmail.com> References: <87r4c4519w.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50468) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRJ9J-0007xd-Bi for emacs-orgmode@gnu.org; Wed, 02 Oct 2013 05:55:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VRJ9A-0004o8-Q8 for emacs-orgmode@gnu.org; Wed, 02 Oct 2013 05:55:17 -0400 Received: from mail-wg0-x236.google.com ([2a00:1450:400c:c00::236]:50697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VRJ9A-0004nL-Gh for emacs-orgmode@gnu.org; Wed, 02 Oct 2013 05:55:08 -0400 Received: by mail-wg0-f54.google.com with SMTP id m15so579760wgh.21 for ; Wed, 02 Oct 2013 02:55:07 -0700 (PDT) In-Reply-To: (Carsten Dominik's message of "Tue, 1 Oct 2013 20:17:08 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Carsten Dominik Cc: emacs-orgmode@gnu.org, Thorsten Jolitz Hello, Carsten Dominik writes: > This is just a cheep way to match any character at all, because \000 should > not be part of any string (in C it indicates the end of a string). > In principle you could put any character you are sure will not turn up, > but \000 seems to be the safest choice. It is > faster (I think) than "\\(.\\|\n\\)*" because the first will > just run fast and streight with a table lookup while the > latter need to always alternate between two alternatives. > I have not timed it, though. On that topic, I would add that "^\000" must be used with care, as it can lead to a stack overflow in regexp matcher error quite easily. In particular, it may be safe to use it to match a property drawer, which will not be very large, but I think it's wrong to use it to match regular blocks or drawers, which can have arbitrary long size. For example a regexp like "[^\000]\\." will fail when matching around 500 lines (72 characters long). Of course, constructs like "\\(.\\|\n\\)*\\." will also fail, but my point is that it is tempting to use "^\000" even though a regexp may not be the correct answer to the problem. Regards, -- Nicolas Goaziou