delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/04/13:27:20

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=3.0 required=5.0 tests=AWL,BAYES_20,SARE_HEAD_XUNSENT,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <BAY127-DS653EB0AD442B9A22B0339A6A70@phx.gbl>
In-Reply-To: <BAY127-DS374577AD66B9A49AF63E9A6A60@phx.gbl> <5E25AF06EFB9EA4A87C19BC98F5C875302B428C2@core-email.int.ascribe.com>
From: "Andriy Sen" <apsen AT hotmail DOT com>
To: <cygwin AT cygwin DOT com>
References: <BAY127-DS374577AD66B9A49AF63E9A6A60 AT phx DOT gbl> <5E25AF06EFB9EA4A87C19BC98F5C875302B428C2 AT core-email DOT int DOT ascribe DOT com>
Subject: Re: grep -P regexp problem
Date: Wed, 4 Mar 2009 13:33:11 -0500
MIME-Version: 1.0
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

> This is not cygwin-specific, so it is really OT for this list, that
> being said...
    Sorry. I will try to figure out where to go then.

> grep -P treats the whole input as a single string, and outputs the
> line (or lines) containing the match for the pattern.  [^0] matches 
> ANYTHING except 0, including linefeeds.

    I guess I oversimplified the regexp :-(

G:\>cat test.s | grep -P "^[^0]1"


G:\>cat test.s | grep -P "^(|[^0])1"
1

G:\>cat test.s | grep -P "^(|.*[^0])1"
a
1

Thanks,
Andriy
 

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019