9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Russ Cox <rsc@swtch.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] grep (or perhaps regex(6)) question
Date: Sun, 10 Jul 2011 20:08:17 -0400	[thread overview]
Message-ID: <CADSkJJXPSVkxjfyO_YJdDiLrW+CKMrbw3JMiEnyvskvNSZ4WeQ@mail.gmail.com> (raw)
In-Reply-To: <201107050956.18175.dexen.devries@gmail.com>

On Tue, Jul 5, 2011 at 3:56 AM, dexen deVries <dexen.devries@gmail.com> wrote:
> on plan9port:
> % echo foobar | 9 grep '$JUNK'
>  -> foobar
>
> that is, p9p grep matches any line with regular expression in form of
> $ANY_REGEX
>
> why is it so?

It's an ancient bug in the Plan 9 grep, a complication
of the way Ken implemented ^ and $: as aliases for \n (!).
It looks like someone added a workaround for this one
case in the Plan 9 sources since I forked them for
plan9port seven years ago.  I pulled it in.

For fun, try seeing what matches '^$^$' across a
variety of grep implementations.

Russ


      parent reply	other threads:[~2011-07-11  0:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-05  7:56 dexen deVries
2011-07-05 11:56 ` Rudolf Sykora
2011-07-05 12:13 ` erik quanstrom
2011-07-05 12:40   ` Rudolf Sykora
2011-07-05 12:58     ` erik quanstrom
2011-07-05 14:01       ` Rudolf Sykora
2011-07-05 14:06         ` erik quanstrom
2011-07-11  0:08 ` Russ Cox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADSkJJXPSVkxjfyO_YJdDiLrW+CKMrbw3JMiEnyvskvNSZ4WeQ@mail.gmail.com \
    --to=rsc@swtch.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).