strops3.tests 387 B

12345678910111213
  1. # regex should accept '+' operator
  2. [[ abcdef =~ a[b-z]+ ]]; echo 1:YES:$?
  3. # newline matches by "match any" patterns
  4. v='
  5. '
  6. [[ "$v" =~ . ]]; echo 2:YES:$?
  7. [[ "$v" =~ "[$v]" ]]; echo 3:no:$? # hmm bash does return 1... why?
  8. [[ "$v" =~ [^a] ]]; echo 4:YES:$?
  9. # should work even without quotes:
  10. [[ $v =~ . ]]; echo 2u:YES:$?
  11. [[ $v =~ [$v] ]]; echo 3u:YES:$?
  12. [[ $v =~ [^a] ]]; echo 4u:YES:$?