blob: 9274766716f8432ca6b22afff17915d96630ecc2 [file] [log] [blame]
Denys Vlasenkod2241f52020-10-31 03:34:07 +01001# regex should accept '+' operator
2[[ abcdef =~ a[b-z]+ ]]; echo 1:YES:$?
3
4# newline matches by "match any" patterns
5v='
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:$?