delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/12/03/21:11:36

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.7 required=5.0 tests=AWL,BAYES_40,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_DF,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <4CF96F70.3090507@veritech.com>
References: <4CF96F70 DOT 3090507 AT veritech DOT com>
Date: Fri, 3 Dec 2010 22:11:19 -0400
Message-ID: <AANLkTikQJEJ6kHKZdzzA_YB_DHgZBevCLDKtAEm6ZgBg@mail.gmail.com>
Subject: Re: Problem with Bash regex test case sensitivity
From: Lee <ler762 AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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 12/3/10, Lee Rothstein   wrote:
> Having some problems with bash case-sensitive regexes, so I wrote
> this little test.
   ... snip ...
> Do I have some Bash or Cygwin parameter set that engenders case
> insensitivity?

Probably the same thing I ran into with LANG != C
try this little test:

$ cat t_regex
#!/bin/bash
# t_regex: Test test regex
# By Lee Rothstein, 2010-12-03, 16:27:38

regex_test () {
if [[ "$1" =~ [A-Z] ]] ; then
   echo Contains Capital Letters: $1
else
   echo Doesn\'t Contain Capital Letters: $1
fi
}

export LANG="C.UTF-8"
regex_test dfgh

export LANG="en_US.UTF-8"
regex_test dfgh


 ~/src
$ ./t_regex
Doesn't Contain Capital Letters: dfgh
Contains Capital Letters: dfgh


> Or, is this a bug?

Welcome to the new world order :-0   I tried to figure out why the
collating sequence changes with the language settings but didn't get
anywhere beyond the fact that it _does_ change.  Oh well.. try, try
again.

Regards,
Lee

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