aboutsummaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-test2/strops3.tests
diff options
context:
space:
mode:
Diffstat (limited to 'shell/hush_test/hush-test2/strops3.tests')
-rwxr-xr-xshell/hush_test/hush-test2/strops3.tests13
1 files changed, 13 insertions, 0 deletions
diff --git a/shell/hush_test/hush-test2/strops3.tests b/shell/hush_test/hush-test2/strops3.tests
new file mode 100755
index 000000000..927476671
--- /dev/null
+++ b/shell/hush_test/hush-test2/strops3.tests
@@ -0,0 +1,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:$?