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]

1.5, 1.7: Bash regex not recognizing word boundaries


These should print "Matched", but they don't:

$ REGEX='\bcat\b'
$ [[ "dog cat bird" =~ $REGEX ]] && echo "Matched"
$ REGEX='\<cat\>'
$ [[ "dog cat bird" =~ $REGEX ]] && echo "Matched"
$

egrep works as expected:

$ egrep -q '\bcat\b' <(echo "dog cat bird") && echo "Matched"
Matched
$ egrep -q '\<cat\>' <(echo "dog cat bird") && echo "Matched"
Matched
$

Behavior is same on 1.5 and 1.7.

Allen




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