Denys Vlasenko | d2241f5 | 2020-10-31 03:34:07 +0100 | [diff] [blame^] | 1 | # regex should accept '+' operator |
2 | [[ abcdef =~ a[b-z]+ ]]; echo 1:YES:$? | ||||
3 | |||||
4 | # newline matches by "match any" patterns | ||||
5 | v=' | ||||
6 | ' | ||||
7 | [[ "$v" =~ . ]]; echo 2:YES:$? | ||||
8 | [[ "$v" =~ "[$v]" ]]; echo 3:no:$? # hmm bash does return 1... why? | ||||
9 | [[ "$v" =~ [^a] ]]; echo 4:YES:$? | ||||
10 | # should work even without quotes: | ||||
11 | [[ $v =~ . ]]; echo 2u:YES:$? | ||||
12 | [[ $v =~ [$v] ]]; echo 3u:YES:$? | ||||
13 | [[ $v =~ [^a] ]]; echo 4u:YES:$? |