Minor regexp oversight for setext headings
alists at vertebrate.co.uk
Sat Oct 7 16:34:00 EDT 2006
On 7 Oct 2006, at 20:10, John Gruber wrote:
> Allan Odgaard <29mtuz102 at sneakemail.com> wrote on 10/7/06 at 6:27 AM:
>> Noticed the patterns for setext style headings are:
>> ^(.+)[ \t]*\n=+[ \t]*\n+
>> Should be:
>> ^(.+?)[ \t]*\n=+[ \t]*\n+
> Why? I can't see where this would make a difference.
Not sure that it would but I've read in several places that non
greedy should be used whereever it can as it's more efficient for the
regex parser and processor. Don't have any benchmarks to back this up
but I'm sure it says so in the mastering regex book.
More information about the Markdown-Discuss