This is the mail archive of the
cygwin
mailing list for the Cygwin project.
1.5, 1.7: Bash regex not recognizing word boundaries
- From: Allen Halsey <allenhalsey at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 19 Oct 2009 20:50:32 +0000 (UTC)
- Subject: 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