delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/12/03/20:20:49

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.7 required=5.0 tests=AWL,BAYES_50,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,TW_DF
X-Spam-Check-By: sourceware.org
X-Yahoo-SMTP: mjD.OBqswBAPbVUxYJaYPvc61jLEnpq8VnBwJGdbEJOPA9xw
Message-ID: <4CF9975C.9000509@sbcglobal.net>
Date: Sat, 04 Dec 2010 01:20:28 +0000
From: Greg Chicares <gchicares AT sbcglobal DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.12) Gecko/20101027 Thunderbird/3.1.6
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Problem with Bash regex test case sensitivity
References: <4CF96F70 DOT 3090507 AT veritech DOT com>
In-Reply-To: <4CF96F70.3090507@veritech.com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 2010-12-03 22:30Z, Lee Rothstein wrote:
[script:]
> if [[ "$1" =~ [A-Z] ]] ; then
>      echo Contains Capital Letters: $1
> else
>      echo Doesn\'t Contain Capital Letters: $1
> fi
[...]
> # WTF, O
> $ t_regex dfgh
> Contains Capital Letters: dfgh

Inspect this option:
  shopt -p | grep nocasematch
Perhaps you have it set in your startup files?

Example of different 'nocasematch' settings with the same command:

$ shopt -u nocasematch
$ if [[ "a" =~ [A-Z] ]] ; then echo UPPER; else echo lower; fi
lower

$ shopt -s nocasematch
$ if [[ "a" =~ [A-Z] ]] ; then echo UPPER; else echo lower; fi
UPPER

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019