summaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-test2/strops3.tests
blob: 9274766716f8432ca6b22afff17915d96630ecc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# regex should accept '+' operator
[[ abcdef =~ a[b-z]+ ]]; echo 1:YES:$?

# newline matches by "match any" patterns
v='
'
[[ "$v" =~ . ]]; echo 2:YES:$?
[[ "$v" =~ "[$v]" ]]; echo 3:no:$? # hmm bash does return 1... why?
[[ "$v" =~ [^a] ]]; echo 4:YES:$?
# should work even without quotes:
[[ $v =~ . ]]; echo 2u:YES:$?
[[ $v =~ [$v] ]]; echo 3u:YES:$?
[[ $v =~ [^a] ]]; echo 4u:YES:$?