[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: case $var in $list) issue
From: |
Zachary Santer |
Subject: |
Re: case $var in $list) issue |
Date: |
Fri, 1 Nov 2024 13:19:38 -0400 |
On Fri, Nov 1, 2024 at 12:56 PM #!microsuxx <fxmbsw7@gmail.com> wrote:
>
> On Fri, Nov 1, 2024, 17:24 Zachary Santer <zsanter@gmail.com> wrote:
>>
>> IFS='|'
>> if [[ one =~ ${array[*]} ]]; then
>> printf 'ye\n'
>> fi
>
>
> but enables free regex parsing in arr
>
> a bit further for complicated strings :
> but still needs regex escaping
> maybe replace every char to be inside a [<here>] char class
>
> arr=( a b c ) IFS=\|
> arr=( "${arr[@]/#/^}" ) IFS=$' \t\n'
> [[ one =~ ${arr[*]/%/$} ]]
>
> plus , regex escape
Ah, yes.
IFS='|'
if [[ one =~ ${array[*]//[][}{)(.*?+|'"\]/\\&} ]]; then
printf 'ye\n'
fi
Your clock cycles are secure.
Wouldn't the same thing apply to the extended pattern matching
operators in your case?
- Re: case $var in $list) issue, (continued)
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, Greg Wooledge, 2024/11/01
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue,
Zachary Santer <=
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, Greg Wooledge, 2024/11/01
- Re: case $var in $list) issue, #!microsuxx, 2024/11/01
- Re: case $var in $list) issue, Zachary Santer, 2024/11/01