emacs-devel
[Top][All Lists]
Advanced

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

Re: Scan of Emacs regexp mistakes


From: Mattias Engdegård
Subject: Re: Scan of Emacs regexp mistakes
Date: Thu, 16 Apr 2020 20:01:37 +0200

16 apr. 2020 kl. 18.08 skrev Paul Eggert <address@hidden>:

>> -    (while (re-search-forward "\\([ \t]*\n[ \t]*\\)+" nil t)
>> +    (while (re-search-forward "[ \t]*\\(?:\n[ \t]*\\)+" nil t)
>>       (replace-match " "))
> 
> Wouldn't it be better to use "[ \t]*\n[ \t\n]*"?

Superior in every way, thank you! Evidenced by disassembling them: your pattern 
results in both loops being optimised, compared to only the first (of three) in 
my clumsy attempt.




reply via email to

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