delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/25/15:20:06

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 25 Nov 2009 15:19:43 -0500
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Cygwin bash regexp matching doesn't treat "\b" properly
Message-ID: <20091125201943.GA28336@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <26500158 DOT post AT talk DOT nabble DOT com> <26500814 DOT post AT talk DOT nabble DOT com> <4B0C4C2A DOT 3080502 AT gmail DOT com> <26503748 DOT post AT talk DOT nabble DOT com> <408995400911241354p27f2c5eek94973673d24fa3b3 AT mail DOT gmail DOT com> <26504147 DOT post AT talk DOT nabble DOT com> <0105D5C1E0353146B1B222348B0411A208A497494E AT NIHMLBX02 DOT nih DOT gov>
MIME-Version: 1.0
In-Reply-To: <0105D5C1E0353146B1B222348B0411A208A497494E@NIHMLBX02.nih.gov>
User-Agent: Mutt/1.5.20 (2009-06-14)
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

On Wed, Nov 25, 2009 at 10:33:53AM -0500, Buchbinder, Barry (NIH/NIAID) [E] wrote:
>aputerguy sent the following at Tuesday, November 24, 2009 5:10 PM
>>Seriously, there are times to use Perl and times not to...  But
>>launching perl seems a bit of overkill when I just have to do a simple
>>match in a .bashrc script or when I need a small shell script wrapper.
>
>Looking at the man page for everything in /bin that matches the pattern
>*.exe find the following that may be of interest.  Testing to see if
>these actually work is left as an exercise for the OP.  :-)
>
>pcregrep - a grep with Perl-compatible regular expressions.
>
>grep, egrep, fgrep - print lines matching a pattern -w, --word-regexp
>Select only those lines containing matches that form whole words.  The
>test is that the matching substring must either be at the beginning of
>the line, or preceded by a non-word constituent character.  Similarly,
>it must be either at the end of the line or followed by a non-word
>constituent character.  Word-constituent characters are letters,
>digits, and the underscore.

If you're interested in a grep which uses perl regexes then:

  % grep --help
  Usage: grep [OPTION]... PATTERN [FILE]...
  Search for PATTERN in each FILE or standard input.
  PATTERN is, by default, a basic regular expression (BRE).
  Example: grep -i 'hello world' menu.h main.c

  Regexp selection and interpretation:
  .
  .
  .
    -P, --perl-regexp         PATTERN is a Perl regular expression
  .
  .
  .

cgf

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

- Raw text -


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