fi
# strip matching quotes at the start and end of the subject
- re='^(['\''"])(.*)\1$'
- if [[ "$subject" =~ $re ]]; then
- subject="${BASH_REMATCH[2]}"
- elif [[ "$subject" =~ ^[\'\"](.*)$ ]]; then
+ # the second characters in the classes are
+ # U+201C LEFT DOUBLE QUOTATION MARK
+ # U+201D RIGHT DOUBLE QUOTATION MARK
+ # U+2018 LEFT SINGLE QUOTATION MARK
+ # U+2019 RIGHT SINGLE QUOTATION MARK
+ re1=$'^[\"\u201C](.*)[\"\u201D]$'
+ re2=$'^[\'\u2018](.*)[\'\u2019]$'
+ re3=$'^[\"\'\u201C\u2018](.*)$'
+ if [[ "$subject" =~ $re1 ]]; then
+ subject="${BASH_REMATCH[1]}"
+ elif [[ "$subject" =~ $re2 ]]; then
+ subject="${BASH_REMATCH[1]}"
+ elif [[ "$subject" =~ $re3 ]]; then
subject="${BASH_REMATCH[1]}"
msg="${msg:+${msg}${nl}} - Subject has leading but no trailing quotes"
fi