emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [BUG] in org-property-drawer-re?


From: Nicolas Goaziou
Subject: Re: [O] [BUG] in org-property-drawer-re?
Date: Wed, 02 Oct 2013 11:55:20 +0200

Hello,

Carsten Dominik <address@hidden> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]