X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Allen Halsey Subject: 1.5, 1.7: Bash regex not recognizing word boundaries Date: Mon, 19 Oct 2009 20:50:32 +0000 (UTC) Lines: 21 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com These should print "Matched", but they don't: $ REGEX='\bcat\b' $ [[ "dog cat bird" =~ $REGEX ]] && echo "Matched" $ REGEX='\' $ [[ "dog cat bird" =~ $REGEX ]] && echo "Matched" $ egrep works as expected: $ egrep -q '\bcat\b' <(echo "dog cat bird") && echo "Matched" Matched $ egrep -q '\' <(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