diff --git a/SC2076.md b/SC2076.md index 6c8c7d7..9b0aa21 100644 --- a/SC2076.md +++ b/SC2076.md @@ -16,4 +16,12 @@ This also means that the problematic code tries to match literal carets and plus ### Exceptions: -If you do want to match literally just to do a plain substring search, e.g. `[[ $foo =~ "bar" ]]`, you could ignore this message, but consider using a more canonical glob match instead: `[[ $foo = *"bar"* ]]`. \ No newline at end of file +If you do want to match literally just to do a plain substring search, e.g. `[[ $foo =~ "bar" ]]`, you could ignore this message, but consider using a more canonical glob match instead: `[[ $foo = *"bar"* ]]`. + +### Compatibility: + +* In Bash 3.2 and newer with shopt `compat31` *disabled (the default)*, quoted patterns are literal whereas unquoted patterns are parsed for regex metacharacters. +* In Bash 3.2 and newer with shopt `compat31` *enabled*, quoted and unquoted patterns match identically. +* In Bash 3.1 quoted and unquoted patterns match identically. + +See http://stackoverflow.com/questions/218156/bash-regex-with-quotes \ No newline at end of file