[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 <mailman.18090.1358877053.855.help-gnu-emacs@gnu.org>,
Peter Dyballa <Peter_Dyballa@Web.DE> 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, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***