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