help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: trivial regexp problem


From: Barry Margolin
Subject: Re: trivial regexp problem
Date: Tue, 22 Jan 2013 15:02:59 -0500
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <address@hidden>,
 Peter Dyballa <address@hidden> wrote:

> Am 22.01.2013 um 17:44 schrieb Barry Margolin:
> 
> > Since it's 
> > immediately followed by .*, which matches anything, the regexp will 
> > match whether or not the line begins with whitespace.
> 
> Yes, it not only matches the beginning of every line, it also matches the 
> beginning of every empty lineĀŠ

That's not an issue, because the regexp includes ":". So it only matches 
on lines that contain a colon.

But there's no difference between:

^[ \t]*.*:

and:

^.*:

There *would* be a difference if you used grouping, e.g.:

^\([ \t]*\)\(.*\):

because this allows you to extract the whitespace prefix and the part of 
the line after it.

-- 
Barry Margolin, address@hidden
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

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