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

Dave Korn dave.korn.cygwin@googlemail.com
Tue Nov 24 22:51:00 GMT 2009


aputerguy wrote:
> OK - I think I found the answer which is that \b is a GNU extension not
> recognized in cygwin.
> 
> So, I guess the question now is there an alternative way of recognizing word
> boundaries?

  Bash man page for '~=' refers to man regex(3) which refers to man regex(7)
which describes word boundary markers as below:

$ [[ "foo" =~ [[:\<:]]foo[[:\>:]] ]]; echo $?
0

$ [[ "foobar" =~ [[:\<:]]foo[[:\>:]] ]]; echo $?
1

$


  (Note that I had to backslash-escape the < and > there.  In other contexts
that might not be needed.)

    cheers,
      DaveK

--
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



More information about the Cygwin mailing list