emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Regular expression too big


From: Chong Yidong
Subject: Re: Regular expression too big
Date: Mon, 26 Mar 2007 16:24:48 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.96 (gnu/linux)

Greg Detre <address@hidden> writes:

>> Looks like your best/only option.  Of course you may also be able to do it
>> all in Emacs by not using regexps.  E.g. if your code looks anything like
>>
>>    (re-search-forward (concat "foo" (regexp-opt mighty-big-list) "bar"))
>>
>> you may be able to use
>>
>>    (while (and (re-search-forward (concat "foo\(.*\)bar"))
>>                (not (member (match-string 1) mighty-big-list))))
>>
>> And of course, use a hash-table rather than a list.
>
> thanks, stefan. that makes sense. but it would need to run within the
> fontification function, so we'd like it to be speedy...

The approach Stefan suggested, using a hash table, may very well be
faster than scanning for an enormous regular expression.





reply via email to

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