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: In-Reply-To: <5E25AF06EFB9EA4A87C19BC98F5C875302B428C2@core-email.int.ascribe.com> From: "Andriy Sen" To: References: <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 Content-Type: text/plain; format=flowed; charset="ISO-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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/