ongoto: No. Quoting $str2 in this context performs a string comparison instead of an ERE match.
Rameshck: The ERE abc? will match ab or abc appearing anywhere in the expansion of $str1 . To match only ab or abc you need to anchor the ERE on both ends:
str1="abccccc"
str2='^abc?$'
if [[ $str1 =~ $str2 ]]; then
echo "same string"
else
echo "different string"
fi