This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Cygwin bash regexp matching doesn't treat "\b" properly


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]