bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: grep --perl-regexp and empty match


From: Stepan Kasal
Subject: Re: grep --perl-regexp and empty match
Date: Fri, 4 Jul 2003 13:25:08 +0200
User-agent: Mutt/1.2.5.1i

Hello,

On Thu, Jul 03, 2003 at 10:11:38PM +0300, Jori Mantysalo wrote:
> > $ echo "<B>one</B> and <B>two</B>" | grep -o -P '<B>.*?</B>'
> 
> > Are you sure you're using GNU grep?

> If I remember correctly, there was some compile-time setting that
> will make perl-style regexps available. I am using Red Hat Linux, maybe
> default grep installed with other distributions has compiled differently?

./configure searches for package ``pcre''---a shared library which
implements Perl Compatible RegExps.  (This can be --disabled, but it's on
by default.)

This means Paul doesn't have pcre installed.

To the original problem:
the bug is that grep -o doesn't print empty matches.  If it were fixed, then

        echo abc | grep -o 'X*'

would output four empty lines.  But it's probably ok, when someone calls grep
with a regexp which matches empty string, they get what they deserve.

Stepan Kasal




reply via email to

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