1)mysql> SELECT 'aXbc' REGEXP '[a-dXYZ]'; -> 1
2)mysql> SELECT 'aXbc' REGEXP '^[a-dXYZ]$'; -> 0
3)mysql> SELECT 'aXbc' REGEXP '^[a-dXYZ]?$'; -> 0 // 0 or 1
4)mysql> SELECT 'aXbc' REGEXP '^[a-dXYZ]+$'; -> 1 // 1 or more
5)mysql> SELECT 'aXbc' REGEXP '^[a-dXYZ]*$'; -> 1 //0 or more
I'm confused about the second comparison. Doesn't it mean that a string which starts with [a-dXYZ] and ends with [a-dXYZ]?
Or does it mean that a string which starts with [a-dXYZ] and ends with [a-dXYZ] whose length is 1? If this is true, using ^ and $ symbols like '^....$' (leftmost and rightmost) eliminates all substrings and analyses only the string as a whole - is that right?
Note: This is not a how can I make it question. I want to understand a cause and effect relation.