This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Problem with Bash regex test case sensitivity
- From: Greg Chicares <gchicares at sbcglobal dot net>
- To: cygwin at cygwin dot com
- Date: Sat, 04 Dec 2010 01:20:28 +0000
- Subject: Re: Problem with Bash regex test case sensitivity
- References: <4CF96F70.3090507@veritech.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