Re: built-in regex matches wrong character

2018-09-06 Thread Eric Blake
On 09/06/2018 12:39 PM, Aharon Robbins wrote: In article , Eric Blake wrote: But bash could be taught to convert any regex that contains a range with both endpoints ASCII into a different bracket expression before handing things over to regcomp(). That is, if the user is matching against [a-d

Re: built-in regex matches wrong character

2018-09-06 Thread Aharon Robbins
In article , Eric Blake wrote: >But bash could be taught to convert any regex that contains a range with >both endpoints ASCII into a different bracket expression before handing >things over to regcomp(). That is, if the user is matching against >[a-d], bash hands [abcd] to regcomp() instead.

Re: built-in regex matches wrong character

2018-09-06 Thread Chet Ramey
On 9/6/18 10:23 AM, Eric Blake wrote: > But bash could be taught to convert any regex that contains a range with > both endpoints ASCII into a different bracket expression before handing > things over to regcomp().  That is, if the user is matching against [a-d], > bash hands [abcd] to regcomp() i

Re: built-in regex matches wrong character

2018-09-06 Thread Eric Blake
On 09/06/2018 09:17 AM, Chet Ramey wrote: On 9/5/18 4:39 PM, Eric Blake wrote: Or, you can use bash's 'shopt -s globasciiranges' which is supposed to enable Rational Range Interpretation, where even in non-C locales, a character range bounded by two ASCII characters takes on the C locale defini

Re: built-in regex matches wrong character

2018-09-06 Thread Chet Ramey
On 9/5/18 6:48 PM, Miguel Amat wrote: > Thanks for your response Eric, please find my attached screenshot > testing both solutions. Seems like setting LC_ALL=C in the environment > works fine while 'shopt -s globasciiranges' does not (also I could be > testing this the wrong way, first time using s

Re: built-in regex matches wrong character

2018-09-06 Thread Chet Ramey
On 9/5/18 4:39 PM, Eric Blake wrote: > Or, you can use bash's 'shopt -s globasciiranges' which is > supposed to enable Rational Range Interpretation, where even in non-C > locales, a character range bounded by two ASCII characters takes on the C > locale definition of only the ASCII characters in

Re: built-in regex matches wrong character

2018-09-06 Thread Chet Ramey
On 9/5/18 2:50 PM, mamatb@mamatb-laptop wrote: > Bash Version: 4.4 > Patch Level: 0 > Release Status: release > > Description: > It seems like bash built-in regex matches some symbols that shouldn't. There are a couple of things to consider here. 1. Bash doesn't have a "built-in" regexp

Re: built-in regex matches wrong character

2018-09-05 Thread Miguel Amat
Thanks for your response Eric, please find my attached screenshot testing both solutions. Seems like setting LC_ALL=C in the environment works fine while 'shopt -s globasciiranges' does not (also I could be testing this the wrong way, first time using shopt). Regards, Miguel On 9/5/18, Eric Blake

Re: built-in regex matches wrong character

2018-09-05 Thread Eric Blake
On 09/05/2018 01:50 PM, mamatb@mamatb-laptop wrote: Description: It seems like bash built-in regex matches some symbols that shouldn't. The following commands shows this: [[ 'º' =~ [o-p] ]] && [[ ! 'º' =~ o ]] && [[ ! 'º' =~ p ]] && echo 'º between o and p but none of t

built-in regex matches wrong character

2018-09-05 Thread mamatb
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/share